From 91c3b9ecd2f45d3e99efd8adb7ae2ef115cd0687 Mon Sep 17 00:00:00 2001 From: rupa Date: Tue, 6 Apr 2010 17:07:20 -0400 Subject: [PATCH] variable quoting for $HOME with spaces. seems like it works. --- z.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/z.sh b/z.sh index fa9ba33..d8c3cd6 100644 --- a/z.sh +++ b/z.sh @@ -39,8 +39,8 @@ z() { for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging } else for( i in rank ) print i "|" rank[i] "|" time[i] } - ' $datafile 2>/dev/null > $datafile.tmp - mv -f $datafile.tmp $datafile + ' "$datafile" 2>/dev/null > "$datafile.tmp" + mv -f "$datafile.tmp" "$datafile" elif [ "$1" = "--complete" ]; then # tab completion awk -v q="$2" -F"|" ' @@ -58,7 +58,7 @@ z() { if( $1 ) print $1 } } - ' $datafile 2>/dev/null + ' "$datafile" 2>/dev/null else # list/go while [ "$1" ]; do case "$1" in @@ -132,11 +132,11 @@ z() { output(wcase, cx, common(wcase, a, 0)) } else if( ncx ) output(nocase, ncx, common(nocase, a, 1)) } - ' $datafile)" + ' "$datafile")" if [ $? -gt 0 ]; then - rm -f $datafile.tmp + rm -f "$datafile.tmp" else - mv -f $datafile.tmp $datafile + mv -f "$datafile.tmp" "$datafile" [ "$cd" ] && cd "$cd" fi fi