Artificial Intelligence
Please fill the required field.

upstream links


prompt.c function::prompt line 777 777 function prompt { # Print the command prompt in the format username@hostname:current-directory printf "%s@%s:%s" "$USER" "$HOSTNAME" "${PWD/$HOME/\~}" # Set the color of the prompt based on the exit status of the previous command if [ $? = 0 ]; then printf "$(tput setaf 2)" # green else printf "$(tput setaf 1)" # red fi # Add the current git branch to the prompt if inside a git repository if [ -d .git ]; then printf " on $(git rev-parse --abbrev-ref HEAD)" fi # Add a $ or # symbol at the end of the prompt based on the user's privileges if [ $(id -u) -eq 0 ]; then # Root user printf " # " else # Normal user printf " $ " fi }