Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Prompt in Bash/Konsole
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Boson
n00b
n00b


Joined: 01 Oct 2003
Posts: 20

PostPosted: Sat Oct 04, 2003 10:00 pm    Post subject: Prompt in Bash/Konsole Reply with quote

Hallo!
Der Prompt der Bash in der KDE-Konsole sieht bei mir seltsamerweise immer so aus:

bash-2.05b$

Allerdings hätte ich gerne einen Prompt wie z.B.

user@hostname:/usr/lib$

In meiner .bashrc steht allerdings:
Code:

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'

was allerdings ja meinen gewünschten Prompt erzeugen sollte.

Wenn ich nun diese Zeile aus der .bashrc manuell eingebe, ändert sich der Prompt folgendermaßen:

user@hostname:/usr/libbash-2.05b$

Irgendwie wird der String "bash-2.05b$" angehängt.

Wie kann ich das beseitigen? Anscheinend pfuscht da Konsole mit rein und hängt den String an.
Ach ja, wenn ich mich über ein tty, also einem Terminal im Textmodus einlogge, zum Beispiel unter Alt+Ctrl+F1, ist der Prompt so, wie ich ihn gerne hätte.
Weiß jemand von euch, was ich dagegen tun kann?
Bin für jede Hilfe dankbar!

Mfg Boson
Back to top
View user's profile Send private message
Shinya
n00b
n00b


Joined: 04 Oct 2003
Posts: 11

PostPosted: Sat Oct 04, 2003 10:21 pm    Post subject: Reply with quote

Soweit ich weiss enthält die Umgebungsvariable "PROMPT_COMMAND" ein Kommando das jedesmal vor dem anzeigen des Prompts ausgeführt wird. Bei Bash steckt der Prompt selbst in der Variablen "PS1". Also solltest du wohl diese verändern.

EDIT: Sirro war wohl schneller. Ich hab mich von IRC ablenken lassen ;)

- Shinya
Back to top
View user's profile Send private message
sirro
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1472
Location: aachen.nrw.de.eu

PostPosted: Sat Oct 04, 2003 10:26 pm    Post subject: Reply with quote

Das mit PROMPT_COMMAND hab ich noch nie gehört. Ich änder meinen Prompt immer über die $PS1-Variable z.B.
Code:
PS1='\u@\h \w$ '

ergibt etwas wie:
Code:
user@hostname /home$
Back to top
View user's profile Send private message
MatzeOne
Guru
Guru


Joined: 07 Sep 2003
Posts: 579
Location: Hamburg, Germany

PostPosted: Sun Oct 05, 2003 12:16 am    Post subject: Reply with quote

Code:
PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]'


auszug aus meiner .bashrc im home-verzeichnis des users :)
_________________
Mit null lässt sich eine ganze Menge machen.
Sportschule Hamburg
Back to top
View user's profile Send private message
Salgar
n00b
n00b


Joined: 03 Oct 2003
Posts: 41
Location: Frankfurt, Hessen, Germany, Europe, Earth, Universe

PostPosted: Sun Oct 05, 2003 5:15 am    Post subject: Reply with quote

Make an appointment with your ophthalmologist and try this:
Code:
PS1="\[\033[0;36m\]\t\[\033[1;35m\]^\[\033[0;32m\]\u\[\033[1;34m\]@\[\033[0;32m\]\h\[\033[1;35m\]:\[\033[1;33m\]\w\[\033[0m\]\[\033[1;34m\]$\[\033[0m\]"

_________________
si hoc signum legere potes, operis boni in rebus lainis alacribus et fructuosis potiri potes!
Back to top
View user's profile Send private message
Boson
n00b
n00b


Joined: 01 Oct 2003
Posts: 20

PostPosted: Sun Oct 05, 2003 8:20 am    Post subject: Reply with quote

Oh ja! Das mit PS1 kannte ich gar nicht. Jetzt hab ich nen brauchbaren Prompt. Danke!

Mfg Boson
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum