mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix for no-argument use of 'cd' in .../fun/dirs
'cd' with no argument is supposed to go to your home directory, but in this override function it produced an error due to an incorrect use of $@ within another parameter substitution, preventing $@ from expanding to zero words. Ref.:781ed34b
-6860-5d47-dfe8-be21280a6b31%40inlv.org src/cmd/ksh93/fun/dirs: _cd(): - Fix the bug by setting a positional parameter if needed, then using a normal and correct "$@" expansion for \cd. - While we're here, restore a historic comment about using 'command' to bypass aliases that exists in the listing of this function in the official 1995 KornShell book (pp. 274-276). Presumably, that comment was deleted when they decided to add the obnoxious and broken default alias command='command ', whenever that was. This branch got rid of that default alias in61d9bca5
.
This commit is contained in:
parent
d66f2a80d8
commit
6109f54a5e
1 changed files with 5 additions and 1 deletions
|
@ -55,7 +55,11 @@ function _cd
|
|||
case $dir in
|
||||
\~*) dir=$HOME${dir#\~}
|
||||
esac
|
||||
\cd "${dir:-$@}" >| /dev/null || return 1
|
||||
# If there are no arguments, use $dir if non-empty.
|
||||
(($#)) || set -- ${dir:+"$dir"}
|
||||
# \cd prevents alias substitution.
|
||||
# You can use command cd with 12/28/93 and newer.
|
||||
\cd "$@" >| /dev/null || return 1
|
||||
dir=${OLDPWD#$HOME/}
|
||||
case $TERM in
|
||||
630)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue