shell script bits & pieces thread

view full story

http://crunchbanglinux.org – I wondered if it might be worth having a thread for people to post bits of code they wanted to share, but which didn't seem worth starting a whole new thread for. Let's keep this one for shell stuff - bash and dash - though; maybe python, perl, lua... should each have their own thread.Anyway, to start off, here's a line that's handy to put in the top of a script if you want to make sure it's run in a terminal. For those scripts that need user interaction:[ -t 0 ] && [ -t 1 ] || { echo "${0}: this script must be run from a terminal" ; exit 1 ;}This tes (HowTos)