[ -n "$var" ] || var=X [ -z "$var" ] && var=X if [ ! "$var" ]; then var=X; fi
There are a lot more ANSI sequences that I could work into that block, but it is quite thorough for the space it occupies.
BONUS:
Here is my script to extract all of the stored WiFi networks and passwords when run as root:
#!/bin/sh find /data \ -name WifiConfigStore.xml \ -print0 | xargs -0 awk ' /"SSID/ { s = 1 } /PreShared/ { p = 1 } s || p { gsub(/[<][^>]+[>]/, "") sub(/^[&]quot;/, "") sub(/[&]quot;$/, "") gsub(/[&]quot;/, "\"") gsub(/[&]amp;/, "\\&") gsub(/[&]lt;/, "<") gsub(/[&]gt;/, ">") } s { s = 0; printf "%-32.32s ", $0 } p { p = 0; print } ' | sort -f
There are a lot more ANSI sequences that I could work into that block, but it is quite thorough for the space it occupies.
BONUS:
Here is my script to extract all of the stored WiFi networks and passwords when run as root: