LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-20-2003, 11:45 PM   #1
luegner
Member
 
Registered: Jul 2003
Location: Henderson, NV
Distribution: Slackware
Posts: 47

Rep: Reputation: 15
long directory and pwd


I noticed that in the shell konsole the current working directory and all parent directories are printed at all times. Is there any way to make it so the command prompt prints only the current working directory and not all its parents in Slack?
 
Old 11-20-2003, 11:59 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Change your PS1 where it has \W to a lowercase \w and it should fix the problem.
 
Old 11-21-2003, 12:24 AM   #3
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Prompt magic
 
Old 11-21-2003, 12:29 AM   #4
luegner
Member
 
Registered: Jul 2003
Location: Henderson, NV
Distribution: Slackware
Posts: 47

Original Poster
Rep: Reputation: 15
That would be in the /etc/profile file right? The related section looks like this:

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2


It looks like there already is a \w (lowercase) in there. Maybe there is a script parameter that needs to be executed differently?
 
Old 11-21-2003, 12:57 AM   #5
luegner
Member
 
Registered: Jul 2003
Location: Henderson, NV
Distribution: Slackware
Posts: 47

Original Poster
Rep: Reputation: 15
I figured it out. Actually you had it reversed. It should be \W not \w to print only the current working directory without its parents.
 
  


Reply



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 to get back quickly to directory with long path name learnfast Linux - Newbie 1 05-20-2005 05:26 AM
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 04:13 AM
pwd and the directory above sneezesnoeze Linux - Newbie 3 03-26-2004 07:18 AM
how to cd to the previously used directory that is no where close to the pwd rootyard Linux - General 3 03-06-2004 10:49 PM
Browsing /mnt directory takes LONG time Rodzilla Mandriva 11 11-19-2003 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration