BioMonth - CSC supercomputing and data management for bioscientists

Prompting — the shell expects something from you

$ PS1="(\!) \h:\W\$ "
\\! history number of this command
\\h hostname up to the first .
\\W the basename of current working directory
\\$ if effective UID is 0, a #, otherwise a $

Look at the prompt string in your machine. Can you figure out how it is built?

Can you figure out what this shell functin does (hint, run it…in a subshell)?

tutorial_prompt () {
    FONT_RESET=$(tput sgr0)
    FONT_BOLD=$(tput bold)
    PS1="\[${FONT_RESET}\]\w \$ \[${FONT_BOLD}\]"
    trap 'echo -ne "${FONT_RESET}" > $(tty)' DEBUG
}