1 |
On Friday 06 October 2006 02:41, James wrote: |
2 |
> This works very good, but it's a bit long. |
3 |
> I prefer just the host name or just the ip address. Using this technique |
4 |
> I get something like this: |
5 |
> "james@icelander:~/projects/manuals - Shell" |
6 |
|
7 |
To get only the hostname (\h is substituted with the hostname as you can read |
8 |
in `man bash`) ... |
9 |
|
10 |
# export PS1=$PS1'\[\033]0;\h\007\]' |
11 |
|
12 |
Or for the ip you can try this evil command... ;) (it depends on |
13 |
sys-apps/iproute2 and will be overridden by $PS1 -- try in another terminal if |
14 |
you just typed the above command) ... |
15 |
|
16 |
# 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/'" |
17 |
|
18 |
(If anyone knows a better way to get the ip and only the ip I'm interested...) |
19 |
|
20 |
Anyway, what's wrong with Mike Williams' suggestion? That's works fine for me. |
21 |
|
22 |
-- |
23 |
Bo Andresen |