Quote:
Originally Posted by
Peasant
So if you have small, efficient script with no nested subshells, are backquotes still the lowest denominator e.g will it run without magic cookie on any unix OS ever produced ?
I would never run the risk of having whatever shell executing my code. Out of pure paranoia you won't see any script without a shebang line stating the shell it is intended to run in explicitly.
You see, i once wrote shell scripts for an installed base of ~22k systems worldwide, ranging from IBM 42Ts and 43Ps (desktop systems) up to big SP/2s and everything in between. Believe me, whatever administrative horror you are able to think of - 5 systems somewhere had exactly this and then some.
root not allowed to write a file in
/tmp? Filesystems with no more free inodes? A user named "root" but with a non-0 UID? I have seen all this and more.
Most of my scripts are not "small" therefore. Not, because they do so much, but because they take extreme care of error handling and take nothing i can think of for granted.
Quote:
Originally Posted by
Peasant
Example would be a simple mv script using basename command in subshell.
basename is IMHO a bad example. I would do that with parameter expansion as (in the interest of speed) anything else that could be done with it.
bakunin