Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 06-03-2003, 12:16 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, 01:36 PM   #2
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
try using PS4 instead of PS1
PS1 only gets runned once when you start the shell, I think.
Old 06-03-2003, 02:50 PM   #3
Registered: Apr 2003
Posts: 87

Original Poster
Rep: Reputation: 15
That didn't seem to work. I replaced PS1 with PS4 in .kshrc and .profile. Neither seemed to work.


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 - Newbie 2 06-03-2003 05:34 PM

All times are GMT -5. The time now is 04:48 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