0
In bashrc file in Fedora/Red Hat I see following line:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
What is the check being done in [ "$PS1" = "\\s-\\v\\\$ " ]
and why is PS1 set only if the test succeeds?
0
In bashrc file in Fedora/Red Hat I see following line:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
What is the check being done in [ "$PS1" = "\\s-\\v\\\$ " ]
and why is PS1 set only if the test succeeds?
1
"\\s-\\v\\\$ "
is a default bash unprivileged prompt.
This line:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
change bash prompt only if it is set to default.
Some useful elements for bash prompt:
\s
- shell name\v
- shell version\u
- username\h
- hostname\t
- current time\d
- current date\W
- current directory