UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 16th, 2004, 08:21 AM
dev0173 dev0173 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: UK
Posts: 18 dev0173 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Getting an absolute pathname

Hi All,

Does anyone know of a command that, given a relative pathname, will return the absolute pathname?

ie, If the current directory is /home/steve/release and in that there's a file called test.file, can I type <cmd> test.file and have it give me /home/steve/release/test.file?

I know I can do it by using pwd and examining the given filename, but I'd really like something to tidy up any parent directory (..) references that may be there.

I've a feeling that there's a standard command for this.

Thanks

Steve

Reply With Quote
  #2  
Old November 16th, 2004, 09:02 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
man realpath

Last edited by guggach : November 16th, 2004 at 09:02 AM. Reason: typo

Reply With Quote
  #3  
Old November 16th, 2004, 09:04 AM
dev0173 dev0173 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: UK
Posts: 18 dev0173 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, but that doesn't seem to exist on my AIX 5.2 machine.

Steve

Reply With Quote
  #4  
Old November 17th, 2004, 09:25 PM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 257 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 46 sec
Reputation Power: 6
For portability, you should use the dirname and
basename utilities. Both exist on AIX 5.2.

Reply With Quote
  #5  
Old November 18th, 2004, 05:48 AM
dev0173 dev0173 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: UK
Posts: 18 dev0173 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, I'll work with that.

Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Getting an absolute pathname


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway