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.



UNIXguide.net
English to Visayan Cebuano Dictionary

Find: Display: hits per page

Suggest a Site
Visayan Cebuano to English Dictionary