Skip to content

Instantly share code, notes, and snippets.

@arajek
Created April 26, 2011 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arajek/942460 to your computer and use it in GitHub Desktop.
Save arajek/942460 to your computer and use it in GitHub Desktop.
My Bash PS1 line
PS1="\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\w"; else echo "\\w"; fi\`]\012\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"
[<username>.<hostname>: <current directory>]
$
@arajek
Copy link
Author

arajek commented Apr 26, 2011

Also, the entire prompts color is set to green or red depending on the return value of the command you just ran.

Green = good return val
Red = error return val

@jterrace
Copy link

Yeah I'm confused what you would use a command counter for?

@arajek
Copy link
Author

arajek commented Apr 26, 2011

@jterrace, you are right, it is a waste of space. Gone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment