LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-17-2005, 09:36 AM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
Changing behavior of pwd with symlinks


Quick question - is there a way to force pwd to show the full path name even after you've followed a symlink?

i.e. when I do:
laura@cleopatra:~$ ln -s /home/laura/Download/whale-0.2 ./WHALE
laura@cleopatra:~$ cd WHALE
laura@cleopatra:~/WHALE$ pwd
/home/laura/WHALE
laura@cleopatra:~/WHALE$

As it is, pwd is rendered rather useless...I know what symlink I followed, what I want to know is what directory I'm in. I'd rather pwd output "/home/laura/Download/whale-0.2."

Does anyknow know if there's a way to do this?
Thanks!
-Laura
 
Old 02-17-2005, 03:18 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
readlink -f `pwd`
if you want it to be generally applicable, something like
if [ -L `pwd` ]; then readlink -f `pwd`; else pwd; fi

But why does it matter? Wherever you go, there you are.
 
Old 02-17-2005, 03:46 PM   #3
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
wunderbar :-) thanks!

And mainly because I'm inordinately fond of doing things like "cd ../../../Documents/blah/foo/bar"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing a users pwd ALInux Linux - Newbie 1 11-07-2005 12:44 PM
Odd root pwd behavior solstice123 Ubuntu 10 10-11-2005 08:54 PM
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 04:13 AM
changing vi behavior scabies Linux - General 5 10-08-2004 08:03 AM
Changing ls behavior Kitohe Slackware 1 10-02-2004 11:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration