Date: Fri, 12 Aug 2005 18:33:08 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Carstea Catalin <carstea.catalin@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: setting up the prompt Message-ID: <20050812153308.GA29558@beatrix.daedalusnetworks.priv> In-Reply-To: <dc6701ba05081208222a528f4f@mail.gmail.com> References: <dc6701ba05081208222a528f4f@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-08-12 08:22, Carstea Catalin <carstea.catalin@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050812153308.GA29558>