ejes consulting

Techincal Consulting Design and Automation

Posts Tagged ‘bash

Amazing One Line Script

leave a comment »

I was stumbling around on the internet this morning and I found this awesome site… (http://www.centerkey.com/tree/)

This guy posted an amazing one line script that will graphically show your directory tree with a simple one line command:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'

and that’s all!!! It works great!

Written by ejes

March 17, 2010 at 11:42 am

Interesting bash prompts

leave a comment »

Sorry I haven’t posted in a while, been busy working on many MANY things.  However, I did find this which I find quite intersting

There’s some really cool bash prompts at this site:

http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04

In my opinion bash is getting quite large and a bit of a resource hog, for a shell that is; but with all it’s bloat comes some VERY decent features, including the ability to modify your prompt to run small shell scripts and display the output. 

The site shows 8 simple examples; but my favorite one displays a happy “^_^” emoticon or a “O_O” emoticon if the last command succeeded or failed:

PS1=“\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$

 

Written by ejes

September 8, 2009 at 10:11 am

Posted in Neat Stuff/Good Ideas

Tagged with , ,