[PROPOSED] Fix unlikely backslash bug in scripts
* tzselect.ksh, workman.sh: Use printf, not echo, if the argument might in theory contain a backslash. --- tzselect.ksh | 9 +++++---- workman.sh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tzselect.ksh b/tzselect.ksh index 7cd8679d..85a8c670 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -145,9 +145,11 @@ do t*) # Undocumented option, used for developer testing. zonetabtype=$OPTARG;; -help) - exec echo "$usage";; + say "$usage" + exit;; -version) - exec echo "tzselect $PKGVERSION$TZVERSION";; + say "tzselect $PKGVERSION$TZVERSION" + exit;; -*) say >&2 "$0: -$opt$OPTARG: unknown option; try '$0 --help'"; exit 1;; *) @@ -516,8 +518,7 @@ while ' ="$distance_table" ) echo >&2 'Please select one of the following timezones,' - echo >&2 'listed roughly in increasing order' \ - "of distance from $coord". + say >&2 "listed roughly in increasing order of distance from $coord." doselect $regions region=$select_result tz=$( diff --git a/workman.sh b/workman.sh index 91621b10..5da55654 100644 --- a/workman.sh +++ b/workman.sh @@ -51,6 +51,6 @@ elif (type nroff && type perl) >/dev/null 2>&1; then } ' else - echo >&2 "$0: please install groff, or mandoc and col" + printf >&2 '%s\n' "$0: please install groff, or mandoc and col" exit 1 fi -- 2.51.0
participants (1)
-
Paul Eggert