Operating System - HP-UX
1748184 Members
4040 Online
108759 Solutions
New Discussion юеВ

Re: changing directory problem with symbolic link in csh

 
SOLVED
Go to solution
robin99
Occasional Advisor

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?
7 REPLIES 7
Steven E. Protter
Exalted Contributor

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
Steven Schweda
Honored Contributor

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".
OldSchool
Honored Contributor
Solution

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....
James R. Ferguson
Acclaimed Contributor

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...
Dennis Handly
Acclaimed Contributor

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 -".
robin99
Occasional Advisor

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.
Dennis Handly
Acclaimed Contributor

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.