From 19420fa802a6d29f6268221894798ba86938a15e Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 24 Oct 2013 22:15:42 +0200 Subject: [PATCH 1/1] Don't use echo for data from the user. --- crontab.d/update.sh | 9 ++++----- lessfilter | 2 +- setup.sh | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crontab.d/update.sh b/crontab.d/update.sh index 173142e..72422fc 100755 --- a/crontab.d/update.sh +++ b/crontab.d/update.sh @@ -50,7 +50,8 @@ echo "###################################" > "$CRONTAB" echo "$HEADER_WARNING" >> "$CRONTAB" echo "###################################" >> "$CRONTAB" echo >> "$CRONTAB" -echo "# It was generated from '$DIRECTORY/*' on `date -R`." >> "$CRONTAB" +printf "# It was generated from '%s/*' on %s." \ + "$DIRECTORY" "`LANG=C date '+%a, %d %b %Y %H:%M:%S %z'`" >>"$CRONTAB" # Enforce C sort order. LC_ALL=C @@ -63,11 +64,9 @@ for file in "$DIRECTORY"/crontab.*; do break fi - echo "Found '$file'." + printf "Found '%s'.\n" "$file" - echo >> "$CRONTAB" - echo >> "$CRONTAB" - echo "## $file:" >> "$CRONTAB" + printf '\n\n## %s:\n' "$file" >>"$CRONTAB" # Strip licenses, multiple empty lines and fix $HOME variables in PATH # (cron doesn't expand variables). diff --git a/lessfilter b/lessfilter index fc9eac4..92d62c4 100755 --- a/lessfilter +++ b/lessfilter @@ -24,7 +24,7 @@ case "$1" in *) # Display directory contents. if test -d "$1"; then - echo "=> Contents of $1:" + printf '=> Contents of %s:\n' "$1" ls "$1" exit 0 fi diff --git a/setup.sh b/setup.sh index 197263d..96b1805 100755 --- a/setup.sh +++ b/setup.sh @@ -33,11 +33,11 @@ terminal_available() { # Usage: apply_optional_replacement() { if test -n "$4"; then - echo "$1: using $2 $4" + printf '%s: using %s %s\n' "$1" "$2" "$4" generate "$1" '' simple_cpp \ "$3" -- "$4" else - echo "$1: removing $2 display" + printf '%s: removing %s display\n' "$1" "$2" grep_i -v "$3" "$1" fi } -- 2.45.2