Re: changing directory problem with symbolic link in csh (1906 Views)
Reply
Occasional Advisor
robin99
Posts: 10
Registered: ‎01-05-2005
Message 1 of 8 (1,906 Views)
Accepted Solution

changing directory problem with symbolic link in csh

Hi All.

My S/W developers are using C Shell in HP-UX 11.11.

One of them asked me about changing directory.

For example,

1) The current directory and result of "ls -al" are :

$pwd
/apl1/apl_sw/wsm.ss

$ls -al
lrwxrwxrwx 1 ypark bksuser 42 Mar 3 10:25 test -> /export/bks/wsm/test

2) He changed directory into test :

$cd test
$pwd
/export/bks/wsm/test

3) He tried to return the previous directory, but couldn't :

$cd ..
$pwd
/export/bks/wsm

I guess that it's csh's problem.

Is there anyone who solve it?
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 2 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

Shalom

Make sure the shell patches for Posix, csh and ksh are installed.

Patch database http://itrc.hp.com

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Honored Contributor
Steven Schweda
Posts: 9,088
Registered: ‎02-23-2005
Message 3 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

Perhaps I'm the one who's confused, but I
thought that "cd .." meant "go up one level
in the directory hierarchy", not "go back to
wherever I was before". "/export/bks/wsm" is
up one level from "/export/bks/wsm/test", so
it's working as I'd expect it to work.

> I guess that it's csh's problem.

That's one way to look at it.

If you want a way to return to a previous
directory, you might investigate pushd and
popd. "man csh".
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 4 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

from the man page as well:
"Relative path changes (such as cd ..), when in a symbolically linked directory, cause csh's knowledge of the working directory to be along the symbolic path instead of the physical path."

I read that as saying it should work as Robin99's developers appear to desire. However, in checking, I found the following:

AIX csh goes up the actual path, not the symbolic link. ksh goes back up the sym-link

Linux csh goes back up the symlink

HP-UX 11.0 - csh goes back up the actual path, not the symlink, ksh goes back up the symlink

of course, I'd question why developers "need" the csh....
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 5 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

Hi:

If your developer's are bent on using 'csh' I would install 'tcsh' instead:

http://hpux.cs.utah.edu/hppd/hpux/Shells/tcsh-6.14.06/

I would also suggest reading:

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

Regards!

...JRF...
Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 6 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

>OldSchool: ksh goes back up the symlink
>I'd question why developers "need" the csh.

Right a real shell works fine, not the scummy csh.
Also, the pwd command will tell you the logical name by default. If you want the physical path, you need "pwd -P".

Also with a real shell, you can use "cd -".
Occasional Advisor
robin99
Posts: 10
Registered: ‎01-05-2005
Message 7 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

Thank you very much for your helps.

Frankly speeking, I don't find how to change working directory instead of physical directory.

But my developer decided to use ksh.
Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 8 of 8 (1,906 Views)

Re: changing directory problem with symbolic link in csh

>I don't find how to change working directory instead of physical directory.

csh thinks they are the same. sh/ksh has the concept of logical or physical path.

>But my developer decided to use ksh.

That's always a good idea. Either sh or ksh.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.