Use node to change your bash prompt

I use the bash shell with git completion on my Mac. It’s awesome except it makes my bash prompt (PS1) kind of long and ungainly: [gist id=35766b37936c617f7cf6] I wanted to optimize space in my terminal, so I searched for alternative ways to display the bash prompt and found an elegant solution on that reduces each directory in PWD to its first letter by evaluating the output of the `pwd` command and piping it through sed (streaming editor). It works really well, but I wanted the last portion of the path displayed as the full directory name. I’m not familiar with sed syntax, and found myself thinking: I know how I would do this in node.js. So I copied the example, opened .bash_profile, and hacked up some code. [gist id=ba1c8fee8a8e5a3561bc] Turns out that when you invoke node with the -e parameter it will evaluate the string that follows. That gave me the exact prompt that I wanted: [gist id=7b277ee279cdba474554] Is it elegant? Not really. Is sed syntax more terse? Absolutely. But you know what, I do what I want and I had fun doing it. :D And yeah, I know, zsh.