Consistently quote literal strings.

Apply some syntax hygiene. Quoting everything is a safe habit because
unquoted things can have subtle side-effects.
This commit is contained in:
Darik Horn 2011-11-22 23:36:51 -06:00
parent 249e6a4cb3
commit 4c14da4130

View File

@ -43,7 +43,7 @@ DESTRUCTION_COUNT='0'
SNAPSHOT_COUNT='0'
WARNING_COUNT='0'
# Global variables.
# Other global variables.
SNAPSHOTS_OLD=''
@ -125,7 +125,7 @@ do_run () # [argv]
else
eval $*
RC="$?"
if [ "$RC" -eq 0 ]
if [ "$RC" -eq '0' ]
then
print_log debug "$*"
else
@ -172,7 +172,7 @@ do_snapshots () # properties, flags, snapname, oldglob, [targets...]
if [ -z "${jj#$ii@$GLOB}" ]
then
KEEP=$(( $KEEP - 1 ))
if [ "$KEEP" -le 0 ]
if [ "$KEEP" -le '0' ]
then
if do_run "zfs destroy $FLAGS '$jj'"
then
@ -200,13 +200,13 @@ GETOPT=$(getopt \
eval set -- "$GETOPT"
while [ "$#" -gt 0 ]
while [ "$#" -gt '0' ]
do
case "$1" in
(-d|--debug)
opt_debug=1
opt_debug='1'
opt_quiet=''
opt_verbose=1
opt_verbose='1'
shift 1
;;
(--default-exclude)
@ -218,7 +218,7 @@ do
shift 1
;;
(-s|--skip-scrub)
opt_skip_scrub=1
opt_skip_scrub='1'
shift 1
;;
(-h|--help)
@ -226,7 +226,7 @@ do
exit 0
;;
(-k|--keep)
if ! test "$2" -gt 0 2>/dev/null
if ! test "$2" -gt '0' 2>/dev/null
then
print_log error "The $1 parameter must be a positive integer."
exit 2
@ -249,7 +249,7 @@ do
shift 1
;;
(-r|--recursive)
opt_recursive=1
opt_recursive='1'
shift 1
;;
(--sep)
@ -270,12 +270,12 @@ do
shift 2
;;
(-g|--syslog)
opt_syslog=1
opt_syslog='1'
shift 1
;;
(-v|--verbose)
opt_quiet=''
opt_verbose=1
opt_verbose='1'
shift 1
;;
(--)
@ -285,7 +285,7 @@ do
esac
done
if [ "$#" -eq 0 ]
if [ "$#" -eq '0' ]
then
print_log error "The filesystem argument list is empty."
exit 5
@ -298,7 +298,7 @@ do
test "$ii" = '//' && SLASHIES=$(( $SLASHIES + 1 ))
done
if [ "$#" -gt 1 -a "$SLASHIES" -gt 0 ]
if [ "$#" -gt '1' -a "$SLASHIES" -gt '0' ]
then
print_log error "The // must be the only argument if it is given."
exit 6