From: Simon Ruderich Date: Thu, 24 Oct 2013 20:15:42 +0000 (+0200) Subject: Don't use echo for data from the user. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;ds=sidebyside;h=19420fa802a6d29f6268221894798ba86938a15e;hp=fdbda4373a045a26e7025d90a2ae1a9fab4d12dd;p=config%2Fdotfiles.git Don't use echo for data from the user. --- 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 }