Make all shell scripts POSIX compliant, and use dash instead of bash.

This commit is contained in:
the_4n0nym0u53 2022-01-03 01:37:30 +01:00
parent a05a6a756a
commit de9220bc73
No known key found for this signature in database
GPG key ID: 35EE09F5481049BB
4 changed files with 14 additions and 11 deletions

View file

@ -2,4 +2,4 @@
For these custom scripts to work, you need to add `$HOME/.local/bin` to your `PATH`. If you use my Zsh config, this is already taken care of.
My scripts use the `dash` shell as the interpreter (the shebang line), so install that to use them. Othewise, change `#!/usr/bin/env dash` to `#!/usr/bin/env bash` or anything else that suits you.
My scripts use the `dash` shell as the interpreter (the shebang line), so install that to use them. Otherwise, change `#!/usr/bin/env dash` to `#!/usr/bin/env bash` or anything else that suits you.

View file

@ -1,5 +1,7 @@
#!/bin/sh
#!/usr/bin/env dash
ivpn connect -last \
&& notify-send -u low "IVPN" "Successfully reconnected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)" \
|| notify-send -u critical "IVPN" "Failed to reconnect to IVPN\!"
if ivpn connect -last; then
notify-send -u low "IVPN" "Successfully reconnected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)"
else
notify-send -u critical "IVPN" "Failed to reconnect to IVPN\!"
fi

View file

@ -1,14 +1,13 @@
#!/bin/sh
#!/usr/bin/env dash
STATUS=`ivpn status | awk '{print "\\\n"$0}' | head -n -1`
TOOLTIP=`echo -E ${STATUS} | cut -c 3-`
CLASS=`echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`
TEXT=""
TOOLTIP=`env echo -E ${STATUS} | cut -c 3-`
CLASS=`env echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`
if [ "$CLASS" == "connected" ]; then
if [ "$CLASS" = "connected" ]; then
TEXT="\uf084" # key
else
TEXT="\uf071" # exclamation-triangle
fi
echo "{\"text\": \"${TEXT}\", \"tooltip\": \"${TOOLTIP}\", \"class\": \"${CLASS}\"}"
env echo "{\"text\": \"${TEXT}\", \"tooltip\": \"${TOOLTIP}\", \"class\": \"${CLASS}\"}"

View file

@ -1,3 +1,5 @@
# Waybar config
This is a beautifully styled config for Waybar, featuring a solarized dark coloscheme and a custom module for showing IVPN connection status (thus requires IVPN client).
Note that the included IVPN scripts use the `dash` shell as the interpreter (the shebang line), so install that to use them. Otherwise, change `#!/usr/bin/env dash` to `#!/usr/bin/env bash` or anything else that suits you.