diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-02-02 13:42:36 -0600 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-02-02 13:42:36 -0600 |
commit | 988cadef2c2e51adbfa64da83ec7d25a8de3d924 (patch) | |
tree | cdf19760f118a49352e58576a2ff0a87eb09b517 /launch | |
parent | 4063c8f3f1808b114d15186f24817f269a88ce4e (diff) | |
parent | 35ea75e1e19add2ffabbf4a8648c808a5d1bebfa (diff) | |
download | scripts-988cadef2c2e51adbfa64da83ec7d25a8de3d924.tar.xz scripts-988cadef2c2e51adbfa64da83ec7d25a8de3d924.zip |
Merge branch 'master' of localgit:scripts
Diffstat (limited to 'launch')
-rwxr-xr-x | launch/launch | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/launch/launch b/launch/launch index b8757e6..050f522 100755 --- a/launch/launch +++ b/launch/launch @@ -1,4 +1,5 @@ #!/bin/sh +awk=awk me() { basename "$0"; } printhelp() { @@ -20,8 +21,20 @@ Config Syntax: HELPDOC } +# Make sure user is using GNU Awk (gawk) +checkawk() { + if ! ($awk -V >/dev/null 2>/dev/null && $awk -V | grep "GNU Awk" >/dev/null); then + if command -v gawk > /dev/null; then + awk=gawk + else + echo "$(me) requires GNU Awk (gawk) to function properly. Please install GNU Awk and try again." + exit 0 + fi + fi +} + gencache() { -awk ' +$awk ' BEGIN { print "run=\"$1\"; shift" print "case \"$run\" in" @@ -89,6 +102,7 @@ cache=$cachedir/cache [ $conf -nt $cache ] && gencache # Command line options +checkawk case "$1" in -g|--gen-cache) echo "Generating new cache: $cache"; gencache && cat $cache ;; -h|--help|'') printhelp ;; |