Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-09-2004, 04:31 AM   #1
LQ Newbie
Registered: May 2004
Distribution: Fedora Core 2 / Damnsmalllinux
Posts: 18

Rep: Reputation: 0
PWD question : Current dir not full path

Hey Gang,

Dumb question I know.. But i can't nut it out.

pwd gives me


I only want to know what dir i'm in. So answer is test or 386
I know I need to pipe this through SED perhaps but can't work it out...


Cheers, M.
Old 06-09-2004, 04:55 AM   #2
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
pwd | awk -F/ '{print $NF}'
Old 06-09-2004, 04:58 AM   #3
LQ Newbie
Registered: May 2004
Distribution: Fedora Core 2 / Damnsmalllinux
Posts: 18

Original Poster
Rep: Reputation: 0
Also found

pwd | sed 's/.*\///'

works too.
Cheers, M.


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
su - and stay in current dir lord-fu Linux - Newbie 2 11-16-2005 08:08 AM
question about putting pwd in $PATH nadroj Linux - Newbie 5 05-30-2005 04:34 PM
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 04:13 AM
Apache: making a dir with username and pwd fledermaus Linux - Networking 1 05-13-2004 09:40 AM
How xterm get known that current dir changed? pvv Programming 3 03-15-2004 08:27 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:39 AM.

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