Change awk(1) to cut(1) in 1992/westley/whereami*
Use of awk(1) is actually overkill and there is already enough overkill if no location is specified: it might nuke the world or the US, depending on submitted entry or alt code (provided in remarks of the author)! :-)
This commit is contained in:
1 parent
6d32012023
commit
ff2bb17212
2 files changed
+4
-16
No files matched your search
@@ -27,14 +27,8 @@ fi
|
||||
|
||||
# try getting the columns the simple way first: tput cols
|
||||
if ! COLUMNS="$(tput cols)"; then
|
||||
# if tput failed for any reason try stty(1) with awk(1).
|
||||
#
|
||||
# Disable this warning of shellcheck as it's wrong: awk needs single quotes.
|
||||
#
|
||||
# SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.
|
||||
# https://www.shellcheck.net/wiki/SC2016
|
||||
# shellcheck disable=SC2016
|
||||
COLUMNS="$(stty size|awk '{print $NF}')"
|
||||
# if tput failed for any reason try stty(1) with cut(1).
|
||||
COLUMNS="$(stty size|cut -f2 -d' ')"
|
||||
fi
|
||||
|
||||
if [[ "$COLUMNS" -lt 80 ]]; then
|
||||
|
||||
@@ -27,14 +27,8 @@ fi
|
||||
|
||||
# try getting the columns the simple way first: tput cols
|
||||
if ! COLUMNS="$(tput cols)"; then
|
||||
# if tput failed for any reason try stty(1) with awk(1).
|
||||
#
|
||||
# Disable this warning of shellcheck as it's wrong: awk needs single quotes.
|
||||
#
|
||||
# SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.
|
||||
# https://www.shellcheck.net/wiki/SC2016
|
||||
# shellcheck disable=SC2016
|
||||
COLUMNS="$(stty size|awk '{print $NF}')"
|
||||
# if tput failed for any reason try stty(1) with cut(1).
|
||||
COLUMNS="$(stty size|cut -f2 -d' ')"
|
||||
fi
|
||||
|
||||
if [[ "$COLUMNS" -lt 80 ]]; then
|
||||
|
||||
Reference in new issue
Block a user