Fix bash syntax for string matching

This commit is contained in:
John Mertz 2024-03-08 12:00:51 -07:00
parent 672daf8889
commit 2be287ef9f
1 changed files with 8 additions and 7 deletions

View File

@ -4,22 +4,23 @@
res=$(echo "John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -theme /home/jpm/.config/rofi/sidebar -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
if [ $res = "Connection" ]; then
# First option is disabled in favour of nm-applet
if [[ $res = "Connection" ]]; then
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
elif [ $res = "John.Me.tz" ]; then
elif [[ $res = "John.Me.tz" ]]; then
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
/usr/bin/systemctl --user restart wg-quick@wg0
elif [ $res = "MailCleaner" ]; then
elif [[ $res = "MailCleaner" ]]; then
/usr/bin/systemctl --user stop wg-quick@wg0
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
elif [ $res = "Disconnect" ]; then
elif [[ $res = "Disconnect" ]]; then
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
/usr/bin/systemctl --user stop wg-quick@wg0
elif [ $res = "Restart" ]; then
if [ "`ip addr show wg0 2> /dev/null`" != "" ]; then
elif [[ $res = "Restart" ]]; then
if [[ "`ip addr show wg0 2> /dev/null`" != "" ]]; then
/usr/bin/systemctl --user restart wg-quick@wg0
fi
if [ "`ip addr show tun0 2> /dev/null`" != "" ]; then
if [[ "`ip addr show tun0 2> /dev/null`" != "" ]]; then
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
fi
else