Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-03-2003, 04:55 PM   #1
Registered: Apr 2003
Posts: 87

Rep: Reputation: 15
current working directory in ksh prompt

I am trying to have the ksh prompt display the current working directory WITHOUT displaying all the directories above it. I checked online, and everywhere it says I should use ${PWD##*/}, so in both my .profile and .kshrc, i added this:

PS1="${PWD##*/} $ "
export PS1

i then used . .kshrc and . .profile, but noticed that it only displayed my home folder, and when I would change folders, it still displayed that same home folder. What could the problem be?

IOW, if my home folder (where my .profile and .kshrc are) was "home", the prompt looks like:

home $

but when I switch to a different directory, the prompt is still:

home $

Thanks for any help.
Old 06-03-2003, 05:16 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I don't have an answer, just a question:
Why are you using ksh rather than bash?

Your chances of getting help with bash
would dramatically increase ;)

Old 06-03-2003, 05:34 PM   #3
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
You need the $ sign directly in front of the PWD something like this:

PS1=`logname`@`hostname -s`:'$PWD>'

Your Korn shell will resemble this:

whoami@hostname:current working directory>


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
how do I find out the current working directory? nodger Programming 2 12-26-2004 12:28 PM
ksh directory comparison script SeT Programming 4 08-30-2004 12:57 PM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-12-2004 12:26 AM
Placing current path in the prompt zepplin611 Linux - General 2 05-13-2004 01:07 PM
current working directory in ksh prompt brian0918 Linux - Software 2 06-03-2003 02:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:39 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration