The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
absolute path for Acrobat reader ramirezmc UNIX for Advanced & Expert Users 3 10-26-2007 05:04 AM
absolute path Kirichiko UNIX for Dummies Questions & Answers 2 10-03-2007 06:30 AM
absolute path filedeliver High Level Programming 4 06-05-2007 05:18 PM
vi - replacing a relative path with absolute path in a file Yinzer955i UNIX for Dummies Questions & Answers 2 09-07-2006 11:47 AM
HOW to make absolute path???? HELP youngvet High Level Programming 1 11-01-2003 04:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-13-2007
kornshellmaven kornshellmaven is offline
Registered User
  
 

Join Date: Apr 2001
Posts: 25
$PWD shows absolute path vs path w/symbolic links

We are migrating our App from HP to Sun and I'm experiencing some "strange" behavior in terms of what is returned from pwd (or $PWD)
We have been running under Korn Shell

$ cd /SYMBOLIC_LNK/subdir/subdir2/symbolic_lnk
$ pwd
displays: /SYMBOLIC_LNK/subdir/subdir2/symbolic_lnk
$ ksh
$ pwd
displays the absolute path to the directory - with no symbolic links

I have scripts that test the dir name and am expecting the dir to contain the symbolic link, not the absolute path - so these are failing.

This worked correctly on HP, but is not working right on Sun
cd

Is there a way to tell Sun to return the path name with the symbolics intact?

Thx,
John
  #2 (permalink)  
Old 06-13-2007
hemangjani hemangjani is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 73
If I'm not wrong, you can specify
pwd -L
The availabel options are -P / -L

try bash shell. I think bash shell by default shows the logical path
  #3 (permalink)  
Old 06-13-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
pwd is both a shell builtin (for ksh) and it is also a shell utility.

The behavior of pwd for the same version of ksh on either box should be the same. Because it is a shell builtin. Are you in the same version of ksh on both boxes, like ksh93 or whatever?

If you have POSIX compliant pwd on your Solaris box you can also use pwd -L or pwd -P as an alias to override pwd.
  #4 (permalink)  
Old 06-13-2007
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
seems like that ksh in the middle is causing you the issue. Everything works pretty much like expected until you reset the ksh kernel, which picks up the absolute path at that point. Try changing your directory AFTER you do the ksh command.

I am running the below on a solaris box

prdora1: :ll -d /bin
lrwxrwxrwx 1 root root 9 Aug 28 2006 /bin -> ./usr/bin
prdora1: :cd bin
/bin
prdora1:bin wd
/bin
prdora1:bin wd -P
/usr/bin
prdora1:bin :echo $PWD
/bin
prdora1:bin :ksh
prdora1:bin wd
/usr/bin
prdora1:bin wd -P
/usr/bin
prdora1:bin :echo $PWD
/usr/bin
prdora1:bin wd -L
/usr/bin
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0