Live data from Hacker News

Halloween Bash Profile Generator

xta.github.com

1–10 of 27 posts

Re: Halloween Bash Profile Generator

#2
Hey everyone,

Thanks for checking out the bash profile generator! I'm a student at Flatiron School[1] NYC (where we have electricity in NYC, no small feat today) and this project came about when we were learning to setup our CLIs in the first week.

Please let me know if you have any comments/feedback on twitter: @rexfeng

[1] http://flatironschool.com/

Re: Halloween Bash Profile Generator

#4
One option that is missing that I really thing is useful is

    wincolour=$yellow
    errorcolour=$red
    # To provide a coloured version of $?, wrapped in ().  Used in PS1
    pretty_exit_code(){
      LAST_COMMAND_STATUS=$?
      if [ $LAST_COMMAND_STATUS = 0 ];
      then echo -e "$wincolour($LAST_COMMAND_STATUS)$black";
      else echo -e "$errorcolour($LAST_COMMAND_STATUS)$black";
      fi
    }
Which just provides the exit code of the last command, but coloured differently for failure or success.

Re: Halloween Bash Profile Generator

#8
post #2

Hey everyone, Thanks for checking out the bash profile generator! I'm a student at Flatiron School[1] NYC (where we have electricity in NYC, no small feat today) and this project came about when we were learning to setup our CLIs in the first week. Please let me know if you have any comments/feedback on twitter: @rexfeng [1] http://flatironschool.com/

Fun project!

I balked, however, at "deciphering web pages to do simple things like displaying the time". All of the prompt escape codes are on the bash man page. That's not a criticism, mind you[1] - just a pointer at the fact that as you develop as a command-line guru, you'll find much information is right there at your finger tips in man pages.

Best of luck in your studies!

[1] No, really. I spend all my life on the command line - it's second nature to me. On the other hand, I wouldn't have a clue where to begin to do a little web app like yours - which probably makes me an amusing old oddity on HN :)

Re: Halloween Bash Profile Generator

#10
post #4

One option that is missing that I really thing is useful is wincolour=$yellow errorcolour=$red # To provide a coloured version of $?, wrapped in (). Used in PS1 pretty_exit_code(){ LAST_COMMAND_STATUS=$? if [ $LAST_COMMAND_STATUS = 0 ]; then echo -e "$wincolour($LAST_COMMAND_STATUS)$black"; else echo -e "$errorcolour($LAST_COMMAND_STATUS)$black"; fi } Which just provides the exit code of the last command, but coloure…

Interesting. I've been using $PIPESTATUS at the start of my prompt for a while now.
Post reply on HN