top | item 4723378

Halloween Bash Profile Generator

79 points| langer | 13 years ago |xta.github.com | reply

26 comments

order
[+] Tyr42|13 years ago|reply
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.
[+] dllthomas|13 years ago|reply
Interesting. I've been using $PIPESTATUS at the start of my prompt for a while now.
[+] rexf|13 years ago|reply
Just added exit status to the page. Thanks for the suggestion.
[+] cjg_|13 years ago|reply
Nice!

A bug report, space tokens should not exhaust. Currently you can at max have 2 spaces, the one that is in the config by default and one from the available tokens.

[+] rexf|13 years ago|reply
Thanks for opening up an issue in the repo.
[+] graywh|13 years ago|reply
Same for the other single characters.
[+] mcgain|13 years ago|reply
Brilliant idea. Well done! Change the name because this will be useful throughout the full year.
[+] rexf|13 years ago|reply
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/

[+] jgw|13 years ago|reply
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 :)

[+] Tyr42|13 years ago|reply
I think it might be better if you could insert text in directly in prompt instead of having the slew of special characters that you had to drag in, and that ran out.

It would also be good to have a way to colour specific parts of it different colours.

[+] Draiken|13 years ago|reply
Very nice! Not sure why it's halloween tho, should be named something else :)
[+] pyre|13 years ago|reply
"Halloween Bash" as in a Halloween party, I'm guessing. Not exactly a 'timeless' name, but seeing as it was put up on Halloween...
[+] Symmetry|13 years ago|reply
Very nice. I sort of with there was an easy way to do fish style prompt paths in bash (/home/username/bin -> /h/u/bin), but that's hardly this excellent website's fault. I guess I'm just annoyed at being tied to bash due to ROS.
[+] paupino_masano|13 years ago|reply
I love this idea - especially for those that are unfamiliar with BASH yet still want to customize their command line experience. Unfortunately due to a previous HN article I now use zsh - would love to see a zsh prompt generator too!
[+] asdfprou|13 years ago|reply
At first I wondered how you managed to extract my username and then I realized it was hardcoded when I looked through the code.
[+] swah|13 years ago|reply
Great impleentation, but its odd that there a limited number of elements you might want many, like spaces.
[+] chyld|13 years ago|reply
Congrats Avi. Your students are killing it.