LWN.net Logo

De-bashing Debian

De-bashing Debian

Posted May 27, 2010 13:54 UTC (Thu) by Tobu (subscriber, #24111)
Parent article: De-bashing Debian

Many bashisms tend to improve maintainability. For example, [[ ]] helps prevent quoting errors, and >() is more foolproof than creating temporary files or fifos. I don't see a big performance impact in supporting some of these extensions in an extended mode for dash, to get a bit more speed than bash without doing a lot of pointless porting.


(Log in to post comments)

De-bashing Debian

Posted May 27, 2010 16:57 UTC (Thu) by jengelh (subscriber, #33263) [Link]

And with systemd [see recent LWN article], eventually there is less need to use shell for booting.

De-bashing Debian

Posted May 28, 2010 11:45 UTC (Fri) by nescafe (subscriber, #45063) [Link]

Hopefully not -- bash syntax makes for perfectly readable conf files. One of my biggest annoyances with upstart is that Scott invented yet another poorly documented config file syntax instead of just embedding bash and using it for all his config needs.

De-bashing Debian

Posted May 27, 2010 20:01 UTC (Thu) by vapier (subscriber, #15768) [Link]

the usage of globs on the RHS of tests makes life a lot nicer too

POSIX: case ${foo} in *"simple string"*) bar=true;; *) bar=false;; esac
bash: [[ ${foo} == *"simple string"* ]] && bar=true || bar=false

i'll take bash every time

De-bashing Debian

Posted May 28, 2010 13:23 UTC (Fri) by mpr22 (subscriber, #60784) [Link]

By all means, use bash in your scripts... just don't lie to the computer by telling it the script is written in sh.

De-bashing Debian

Posted Jun 3, 2010 18:03 UTC (Thu) by vapier (subscriber, #15768) [Link]

this article is about moving from bash to POSIX shell, not about bashisms showing up in scripts using /bin/sh as their interpreter

De-bashing Debian

Posted Jun 7, 2010 12:20 UTC (Mon) by nye (guest, #51576) [Link]

>this article is about moving from bash to POSIX shell, not about bashisms showing up in scripts using /bin/sh as their interpreter

In that case I have completely misunderstood this article, as I read it as being entirely about bashisms showing up in scripts using /bin/sh as their interpreter.

De-bashing Debian

Posted May 28, 2010 10:00 UTC (Fri) by joey (subscriber, #328) [Link]

The correct thing to do if you have a good reason to use a bash-specific feature in your shell script is to put #!/bin/bash at the top of it.

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