PS1 for Bash and Git
Posted on March 15, 2008
My Bash Kong-Fu!
Basically a modification of the bash command prompt to display current git branch.
git clone git@github.com:igouss/config-files.git
http://github.com/igouss/config-files/tree/master
—-
And then 15 minutes later I found http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/completion/git-completion.bash;hb=HEAD
Filed Under Uncategorized | 2 Comments
Bash pipe
Posted on March 12, 2008
I did not know that I can use pipes with bash functions:
bash$ demo() { while read input; do echo “Hello” $input; done; }
bash$ ls | demo
Hello bin/
Hello boot/
Hello dead.letter
Hello dev/
Hello etc/
Hello home/
Hello initrd/
Hello lib/
Hello lost+found/
Hello media/
Hello mnt/
Hello opt/
Hello proc/
Hello root/
Hello sbin/
Hello sys/
Hello tmp/
Hello usr/
Hello var/
It’s even possible to have anonymous functions
ls -la | { read total; echo “And my total is $total”; while read line; do echo “Hello” $line; done; }
Filed Under Uncategorized | 2 Comments
