w8...@mail.petersen.net wrote:

> cd()
> {
>    builtin cd "$0" && xtitle $HOST: $PWD
> }
> 
> This no longer works correctly since I upgraded bash to the version
> listed above.  Instead, when I use cd without an argument the following
> error message:
> 
> -bash: $@: unbound variable
> 
> Repeat-By:
>       Add the above function to your .profile.  When you cd
> with an argument as in cd /var/tmp it works as expected.  When
> you wish to return to your home directory do a cd with no argument.
> The error appears every time.

Run without `set -u' enabled.  Bash-4.0 was changed to include $@ and $*
in the variables subject to `set -u'.  Those expansions will exit the
shell when there are no positional parameters.

(There is a problem with this: ${@:-foo} also exits the shell with an
unbound variable error.  I'm working on a fix for that.)

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/


Reply via email to