[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Setting Prompt



ktb <ktb@binary.net> writes:

> show.  I took a look at the man page for  bash.  It said that "\w" would
> list my working directory.  So I tried the following:

> If I use,
> export PS1='\w:\\$ '

> I get,
> ~:$

That is a feature.

The tilde is a commonly-used abbreviation for "the home directory of
the current user". You can use it when typing commands too, and it
will be expanded before the program you run see the arguments. Try
e.g.:

~:$ echo I live in ~
I live in /home/kent
~:$ 

bash automatically tries to use this abbreviation when it writes out
the working directory. It assumes that when working somewhere deep
inside your home you would rather see

~/foo/bar/xyzzy/grizzle:$

than

/home/kent/foo/bar/xyzzy/grizzle:$

There doesn't seem to be any way of turning this feature off in
standard bash.

-- 
Henning Makholm
http://www.diku.dk/students/makholm


Reply to: