LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PWD question : Current dir not full path (https://www.linuxquestions.org/questions/programming-9/pwd-question-current-dir-not-full-path-191414/)

facets 06-09-2004 04:31 AM

PWD question : Current dir not full path
 
Hey Gang,

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

pwd gives me

/home/work/test
/usr/files/386

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...

Ideas?

Cheers, M.

rkef 06-09-2004 04:55 AM

Code:

pwd | awk -F/ '{print $NF}'

facets 06-09-2004 04:58 AM

Also found

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

works too.
Cheers, M.


All times are GMT -5. The time now is 01:48 PM.