which command will fail if pwd output is very long?

Issues related to applications and software problems
Post Reply
centguy
Posts: 271
Joined: 2008/08/11 16:03:29

which command will fail if pwd output is very long?

Post by centguy » 2018/08/01 07:10:05

Curiously I found "which" command to fail in one occasion..

Decription:

pwd command gives 277 characters (I tend to give a slightly long name for each directory and love to work
with subdirectories to help me to navigate through trees, so far no major problem. Even my Fortran program
has a default of 500 characters to hold an absolute path names of a file)

seems to cause which command to fail:

which bash-a-script
Can't get current working directory

Is this is the limitation of

Linux centos69-hp 2.6.32-754.2.1.el6.x86_64 #1 SMP Fri Jul 13 12:50:12 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


Wonder if CentOS 7.x does not have this problem.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: which command will fail if pwd output is very long?

Post by avij » 2018/08/01 07:28:46

CentOS 7 has the same problem. If you run which which (somewhere where it's allowed) you'll see that which is probably an alias:

Code: Select all

$ which which
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
	/usr/bin/which
Apparently it's the --show-dot option that is causing the problem.

Post Reply