Use of "printf" command to avoid shell interpretation of dashes ("-") or percent sign ("%")

This commit is contained in:
Moisés Carvalho 2020-05-27 15:37:26 -03:00
parent 131bcdae10
commit ec2739e9ba

View file

@ -9,7 +9,7 @@ get_ssid()
Linux) Linux)
SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p') SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p')
if [ -n "$SSID" ]; then if [ -n "$SSID" ]; then
echo -- "$SSID" printf '%s' "$SSID"
else else
echo 'Ethernet' echo 'Ethernet'
fi fi