Hello, I was looking to have a ProtonVPN ready to go on start up. As such, I wrote the following and placed it into my bashrc:
#run vpn client if it is not running isconnected=$(protonvpn status | grep Status) isconnectedword=$(echo $isconnected | cut -d' ' -f 2) if [ $isconnectedword = "Connected" ] then echo VPN is connected elif [ $isconnectedword = "Disconnected" ] then echo VPN not Connected! echo Connecting now... read -p "Please press ENTER" var if [ $isconnectedword = "Disconnected" ] then sudo protonvpn c -f fi fi unset $isconnectedword
Now, the intention was to have the VPN ready to go upon booting up the computer, so, in tandem with this code, I used gnome tweaks to set the terminal to open on startup. Problem is; this combination of modifications causes some error in the operating system boot procedure, whereby the system hangs at a blank screen indefinitely. As such, I cannot get into the operating system unless I comment out the above code. A little bit of code testing has shown that the common cause in every test seems to be the
sudo protonvpn c -f line. I thought adding an if statement after a call to action would solve the problem (as shown in the code) by ensuring there are steps that mean the command itself does not run at startup, but this method does not work, which is strange. Why would a line that is not run at startup be causing such an error? is having a sudo command in the bashrc not possible?