|
|
Log in / Subscribe / Register

dash/ash

dash/ash

Posted Oct 1, 2014 21:04 UTC (Wed) by josh (subscriber, #17465)
In reply to: dash/ash by chutzpah
Parent article: Bash gets shellshocked

Personally, I'd argue that if your shell script has gotten sufficiently complicated to warrant making it bash-specific, you should write it in something other than shell.


to post comments

Bash can be a big win for many scripts

Posted Oct 2, 2014 13:51 UTC (Thu) by CChittleborough (subscriber, #60775) [Link]

I find bash nearly ideal for relatively simple scripts. OTOH, I've written a few scripts in bash that I later rewrote in Perl when adding functionality. (In my experience, any script that takes more than about 100 lines of Bash code probably should be rewritten into Perl or Python or something, as should any Bash script in which you get bugs or headaches from string substitutions.)

Useful bashisms

Posted Oct 2, 2014 14:52 UTC (Thu) by gwolf (subscriber, #14632) [Link]

Some bashisms are just too useful to dismiss. From the top of my mind, I often thank bash for being able to diff the output from two running programs without having to juggle them into named pipes:

$ diff -u <(cmd1) <(cmd2)

is way easier and clearer than

$ F1=`tempfile`
$ F2=`tempfile`
$ cmd1 > $F1 &
$ cmd2 > $F2 &
$ diff -u $F1 $F2
$ rm $F1 $F2

Of course, it makes sense to include this bashism in your scripts. And, of course, that'd make your scripts depend on bash.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds