[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Symlinks handled inconsistently by cd and wild card expansion

From: Topi Mäenpää
Subject: Symlinks handled inconsistently by cd and wild card expansion
Date: Thu, 30 Mar 2017 10:13:09 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall uname output: Linux topi 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 11
Release Status: release


The cd command remembers where I came from, and "cd .." from a
symlinked directory comes back to the directory of the link. Wild card
expansion works differently and always reads the link target. I
understand the reason in general, but it would make sense that they
behaved the same when used on the command line.


I have the following directory hierarchy (-> denotes a symlink)

./b/11 -> ../a/11
./b/2 -> ../a/2

$ cd b/2
$ echo ../*       # I'd expect to see "../11 ../2 ../3"
../1 ../11 ../2
$ cd ../*1*       # changes pwd to a/1, expected b/11
$ cd ../..        # back to root
$ cd b/2/../*3*   # should go to b/3
bash: cd: b/2/../*3*: No such file or directory


When expanding file names on the command line, don't use symlink
targets but the actual paths (pwd or typed).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]