]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - shell/functions
shell/functions: don't use echo on user strings
[config/dotfiles.git] / shell / functions
index 10283a393f3903afd5aba46178bc26eb933c4bc4..12874c6228a4f9f1f769729f8610a8d4fda318d8 100644 (file)
@@ -1,6 +1,6 @@
 # Shell functions useful to all shells.
 
-# Copyright (C) 2011-2012  Simon Ruderich
+# Copyright (C) 2011-2014  Simon Ruderich
 #
 # This file is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,8 +21,8 @@
 # Doesn't fit perfectly in this file, but this is the best place to make it
 # available everywhere.
 source_debug() {
-    if [ x$DEBUG != x ]; then
-        echo "$@"
+    if test "x$DEBUG" != x; then
+        printf '%s' "$*"
     fi
 }
 
@@ -30,14 +30,14 @@ source_debug() {
 source_config() {
     source_debug "source_config(): $1"
 
-    if [ -f $1 ]; then
+    if test -f "$1"; then
         source_debug ". $1"
-        . $1
+        . "$1"
     fi
 
-    if [ -f $1.local ]; then
+    if test -f "$1.local"; then
         source_debug ". $1.local"
-        . $1.local
+        . "$1.local"
     fi
 }