zshrc: using FOO=${FOO:-default} instead of (( ${+FOO} )) || FOO=default
authorFrank Terbeck <ft@grml.org>
Sat, 2 Feb 2008 09:41:09 +0000 (10:41 +0100)
committerFrank Terbeck <ft@grml.org>
Sat, 2 Feb 2008 09:41:09 +0000 (10:41 +0100)
This is more correct, IMHO.
The old way only sets the default if $FOO is unset; whereas the new way
sets the default if $FOO is unset *or* empty (which is certainly desirable,
if you think of variables like $PAGER).

etc/zsh/zshrc

index 42de4c4..c752a63 100644 (file)
@@ -369,7 +369,7 @@ else
 fi
 
 #v#
-(( ${+PAGER} )) || export PAGER="less"
+export PAGER=${PAGER:-less}
 
 #v#
 export MAIL=${MAIL:-/var/mail/$USER}
@@ -381,7 +381,7 @@ export SHELL='/bin/zsh'
 check_com -c dircolors && eval $(dircolors -b)
 
 # set width of man pages to 80 for more convenient reading
-# (( ${+MANWIDTH} )) || export MANWIDTH=80
+# export MANWIDTH=${MANWIDTH:-80}
 
 # Search path for the cd command
 #  cdpath=(.. ~)