setting up the prompt
Giorgos Keramidas
keramida at ceid.upatras.gr
Fri Aug 12 15:33:17 GMT 2005
On 2005-08-12 08:22, Carstea Catalin <carstea.catalin at gmail.com> wrote:
> how can i change the prompt to view always the current directory?
> Ex:
> 1. (/usr/local)#cd local1
> 2.(/usr/local/local1)#pwd
> 2.(usr/local/local1)#/usr/local/local1
That depends on your shell.
For tcsh that would be:
% set prompt = '%m:%~%# '
beatrix:~% cd /usr/local
beatrix:/usr/local% cd bin
beatrix:/usr/local/bin%
A slightly different prompt ``escape sequence'' that shows the absolute
path even if you are in your HOME directory is ``%/'', which would show
the following:
% set prompt = '%m:%/%# '
beatrix:/home/keramida% cd /usr/local
beatrix:/usr/local% cd bin
beatrix:/usr/local/bin%
For bash, you have to use a slightly different set of commands:
$ export PS1='\h:\w\$ '
beatrix:~$ cd /usr/local
beatrix:/usr/local$ cd bin
beatrix:/usr/local/bin$
or
$ export PS1='\h:${PWD}\$ '
beatrix:/home/keramida$ cd /usr/local
beatrix:/usr/local$ cd bin
beatrix:/usr/local/bin$
FYI, all the ``prompt escape sequences'', the special strings you can
add to $prompt in TCSH and $PS1 in bash to display various bits of
information, are described in the manpages of the shells:
% man tcsh
$ man bash
More information about the freebsd-questions
mailing list