LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 06-03-2003, 03:55 PM   #1
brian0918
Member
 
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, 04:16 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,972
Blog Entries: 11

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
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 ;)

Cheers,
Tink
 
Old 06-03-2003, 04:34 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
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>
 
  


Reply


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


All times are GMT -5. The time now is 09:03 AM.

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