On Thu, Jul 31, 2025 at 12:58:57 +0200, Phi Debian wrote:
> ksh93 always treats cd "$undefined" as an error, this is true but the error
> is not related to cd
> ====
> TC$ echo $KSH_VERSION
> Version AJM 93u+m/1.1.0-alpha+11981f5f/MOD 2025-06-22
> TC$ cd $Undefined
> ./arch/linux.i386-64/bin/ksh: Undefined: parameter not set
> TC$ cd "$Undefined"
> ./arch/linux.i386-64/bin/ksh: Undefined: parameter not set
> ====

You seem to have the set -u option turned on for some reason.

hobbit:~$ ksh
$ echo "$KSH_VERSION"                                                         
Version AJM 93u+m/1.0.4 2022-10-22
$ echo $undefined

$ cd $undefined
$ set -u
$ echo $undefined
ksh: undefined: parameter not set
$ cd $undefined
ksh: undefined: parameter not set

In order to get the expected error, you would have to turn off set -u
and quote properly:

$ set +u
$ cd "$undefined"
ksh: cd: bad directory

Reply via email to