Skip to main content
Explanation
Source Link

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set, its contents shows up in the window's titlebar.

Explanation:

PS1='...'

Make no variable expansion.

PS1='...$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")...'

Execute a test: if variable "PS1TITLE" is empty, do not display it. If the string exists and is non-empty, it is displayed with a colon.

The rest of the PS1 string is taken from a Debian system's .bashrc.

Bash executes PS1 every time prompt is displayed and updates everything accordingly.

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set, its contents shows up in the window's titlebar.

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set, its contents shows up in the window's titlebar.

Explanation:

PS1='...'

Make no variable expansion.

PS1='...$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")...'

Execute a test: if variable "PS1TITLE" is empty, do not display it. If the string exists and is non-empty, it is displayed with a colon.

The rest of the PS1 string is taken from a Debian system's .bashrc.

Bash executes PS1 every time prompt is displayed and updates everything accordingly.

deleted 16 characters in body
Source Link

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set this, its contents shows up in the window's titlebar, otherwise normal prompt.

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set this shows up in the window's titlebar, otherwise normal prompt.

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set, its contents shows up in the window's titlebar.

Source Link

A one-liner:

PS1='\[\e]0;$( [ "$PS1TITLE" == "" ] || echo -n "$PS1TITLE  :  ")${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

When the variable PS1TITLE is set this shows up in the window's titlebar, otherwise normal prompt.