Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i add the current directory to command prompt in solaris ?

Status
Not open for further replies.

pissallio

IS-IT--Management
Oct 2, 2004
36
0
0
CN

log in to the system using C shell, .cshrc file resides in the user's home directory and the following entries was included in the file :
set prompt=`hostname`%
As we know the above command is to set the command prompt.
What can i do in order to include the current directory name in the command prompt, such as after i execute "cd /usr/bin", the command prompt becomes the following :
VNC:/usr/bin/%
If this could be archieved, it could prevent me from using "pwd" to acquire the current directory which i was in.

Thanks in advance
 
in sh and csh this is a little bit complex; you need to alias cd to a small script, which changes directory and sets prompt to your new directory

you better use tcsh or bash (in tcsh it's %~, eg
Code:
set prompt = "%B${USER}@${HOST}:%~ $%b"
will set a bold prompt (if your terminal supports bold) eg.
fp@admin6: ~/mysubdir $ ls


Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years
 
In ksh you can also add your username and in case of a long path you want to type on a new line.
Put this in your .profile

PS1="$LOGNAME@$(uname -n):\$PWD$
% "; export PS1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top