Computing.Net > Forums > Unix > how to set my prompt to display current directory

how to set my prompt to display current directory

Reply to Message Icon

Original Message
Name: michael
Date: April 5, 2000 at 19:52:37 Pacific
Subject: how to set my prompt to display current directory
Comment:

Can anyone show me how to edit my login script so that the commant prompt will always show the current directory ? Thanks on advance.


Report Offensive Message For Removal

Response Number 1
Name: unisol
Date: April 6, 2000 at 12:33:54 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

Type:
set prompt="%~/"


Report Offensive Follow Up For Removal

Response Number 2
Name: michael
Date: April 6, 2000 at 23:02:06 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

Thanks, but the above doesn't work, all I get is a prompt like %~/

But what I would like is the prompt to display the current directory I am in. Thanks.


Report Offensive Follow Up For Removal

Response Number 3
Name: Alick
Date: April 7, 2000 at 00:23:27 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

Depends on your shell - the Bourne shell will not do this. I use the Korn shell on SVR4, and this one also gives my login name and the system I am on:

PS1="[$LOGNAME@`uname -n`]\$PWD> "


Report Offensive Follow Up For Removal

Response Number 4
Name: Sean
Date: April 10, 2000 at 01:40:03 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

If you are using BASH, edit your .bashrc file so that it contains the line,

PS1=\w

"\w" is an escape sequence for the current working directory.

I believe there is a HOWTO on editing BASH prompts- if you have any problems with my suggestion, look for the BASH prompt HOWTO online.


Report Offensive Follow Up For Removal

Response Number 5
Name: unisol
Date: April 10, 2000 at 04:52:48 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

Yeap
I forgot to mention
i use tcsh


Report Offensive Follow Up For Removal


Response Number 6
Name: bob
Date: July 24, 2001 at 15:30:18 Pacific
Subject: how to set my prompt to display current directory
Reply: (edit)

On tcsh use:
set prompt="%B[%n@%M]:%/> "

%B - bold
%n - username
%M - hostname
%/ - current working directory



Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: how to set my prompt to display current directory

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software