]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Don't use echo for data from the user.
authorSimon Ruderich <simon@ruderich.org>
Thu, 24 Oct 2013 20:15:42 +0000 (22:15 +0200)
committerSimon Ruderich <simon@ruderich.org>
Thu, 24 Oct 2013 20:15:42 +0000 (22:15 +0200)
crontab.d/update.sh
lessfilter
setup.sh

index 173142ec214db7ddb29eed6ec690704ced1a97ed..72422fc90390e3c767eddfacd5fc676045eae484 100755 (executable)
@@ -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).
index fc9eac4e13a760bfdc94238c6130fea446b48148..92d62c42009d762cbdee483eac5ecfd4fd03046f 100755 (executable)
@@ -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
index 197263de0aca28cd92d749de5adb1d6599c19afc..96b18054c8232723ecb362f8929424ae51074a43 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -33,11 +33,11 @@ terminal_available() {
 # Usage: <file> <name> <grep-string> <value>
 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
 }