35 ms·
Yep pretty much, but it can be up to 100 lines depending on the nature of the script. To the article, I've never used a shell that doesn't understand [[ (guara
by emmelaich 13y ago
Yep pretty much, but it can be up to 100 lines depending on the nature of the script.
To the article, I've never used a shell that doesn't understand [[ (guaranteed to be builtin, not sensitive to the hyphen issue) and {,} expansion.
For the "for file in *; ... " that is also susceptible to the shell arg limits and is fairly hairy.
Lastly if you're concerned about performance -- well, it's definitely time to leave shell for something better.
- nandhp 13y ago> I've never used a shell that doesn't understand [[ That may be, but that doesn't mean they aren't pretty widespread. [[ and {,} are bashisms. However, they still work when bash is executed as /bin/sh, as is the case on RedHat and some other Linux distributions. However, other distributions, including Debian, Ubuntu, and any embedded system using Busybox, point the /bin/sh symlink to a version of ash, the Almquist shell. It is used for scripts instead of bash because it is much smaller and faster (reportedly, Debian/Ubuntu boot speed improved significantly -- leaving the shell isn't a very good option for sysvinit).
- emmelaich 13y ago[[ is from ksh88 or earlier; {,} is apparently from csh. (Funny; I could've sworn I used {} in ksh under Solaris but apparently not!) Your point stands though, they are bashisms for all intents and purposes on Linux. As to speed -- well, again, I think if you want speed don't use shell. For startup you're better off redesigning the whole damn thing (cue systemd). Changing shell is like overclocking your cpu when you should be choosing a better algorithm.