Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

Top Document: comp.unix.aix Frequently Asked Questions (Part 2 of 5)
Previous Document: 1.306: Why do PIDs run non-sequentially?
Next Document: 1.401: How do I set up ksh for emacs mode command line editing?


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

1.400: How do I make an informative prompt in the shell?


In the Korn Shell (ksh), the PS1 variable is expanded each time it is
printed, so you can use:

$ export myhost=`hostname`
$ PS1='$LOGNAME@$myhost $PWD \$ '

to get, e.g. 

bengsig@ieibm1 /u/bengsig $

In the C-shell, use:

% set myhost=`hostname`
% alias cd 'chdir \!* > /dev/null; set prompt="$LOGNAME@$myhost $cwd % "'
% cd

to get, e.g.

bengsig@dkunix9 /u/bengsig/aixfaq %

There is no easy solution in the Bourne Shell.  Use the Korn Shell instead.



Top Document: comp.unix.aix Frequently Asked Questions (Part 2 of 5)
Previous Document: 1.306: Why do PIDs run non-sequentially?
Next Document: 1.401: How do I set up ksh for emacs mode command line editing?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
bofh@mail.teleweb.pt (Jose Pina Coelho)

Last Update May 13 2007 @ 00:21 AM