On Friday 06 October 2006 02:41, James wrote:
> This works very good, but it's a bit long.
> I prefer just the host name or  just the ip address. Using this technique
> I get something like this:
> "[EMAIL PROTECTED]:~/projects/manuals - Shell"

To get only the hostname (\h is substituted with the hostname as you can read
in `man bash`) ...

# export PS1=$PS1'\[\033]0;\h\007\]'

Or for the ip you can try this evil command... ;) (it depends on
sys-apps/iproute2 and will be overridden by $PS1 -- try in another terminal if
you just typed the above command) ...

# export PROMPT_COMMAND="ip -o -4 addr show scope global | sed -r 's/.* 
([12]?[0-9]?[0-9](\.[12]?[0-9]?[0-9]){3})\/.*/\x1b]0;\1\x7/'"

(If anyone knows a better way to get the ip and only the ip I'm interested...)

Anyway, what's wrong with Mike Williams' suggestion? That's works fine for me.

-- 
Bo Andresen

Attachment: pgpyJbYsz3ISl.pgp
Description: PGP signature

Reply via email to