check variable content size in sh script
quartz at sneakertech.com
Sun May 19 06:43:42 UTC 2013
> I say this from a FreeBSD context. It may entirely be possible that a
> Linux distro uses bash in /bin/sh
Yes. For most (all?) linux distros as well as osx, /bin/sh is actually
bash. When I say "emulation mode" I mean running a script with a
"#!/bin/sh" header on a system that doesn't have a real copy of sh.
Whatever shell ends up running the script is effectively emulating sh's
environment, at least in my mind.
Bash is well known for not complaining when you use bash-specific
features in a script which uses a "#!/bin/sh" header. This trips up many
a programmer and causes script failures on systems where sh is not
actually bash in disguise. This is why I question some things as to
whether they're *really* valid pure sh syntax and not something that
just happens to work in whatever shell is pretending to be sh (which I
thought was tcsh on this machine I just did that test on, but on second
look maybe not).
it has a certain smooth-brained appeal
More information about the freebsd-questions