[Discuss] Scripting languages (was Re: rsync v. cp in data migration)
Jerry Feldman
gaf at blu.org
Mon May 27 13:31:58 EDT 2013
On 05/27/2013 11:34 AM, Derek Martin wrote:
> On Mon, May 27, 2013 at 11:11:03AM -0400, Richard Pieri wrote:
>> I'm not a programmer. Never was, probably never will be. I'm a
>> sysadmin. Bourne is my go-to language for anything repetitive for
>> two simple reasons: it's there, and it doesn't change. Every UNIX
>> and Unixalike has Bourne shell. Every single one. And it works the
>> same on all of them.
> They don't though, which is in fact one of the mines in the mine field
> I mentioned. Just to give one concrete example: The built-in echo
> command behaves differently on SysV-based Unix and BSD-based Unix.
> Typically on those systems, the on-disk echo command behaves as does
> the shell built-in, though some systems may have both versions
> installed in different paths...
>
> We witnessed some of the problems that this causes when Debian
> switched from using bash to dash as its rc script shell. That switch
> broke many things (though many of those things were caused by scripts
> using bash-isms, not all of them were). These days, on many Unix
> systems, the Bourne shell is actually the "POSIX-compatible" shell,
> which again, behaves differently from the original Bourne shell,
> though you might (or might not) be able to induce it to behave like
> the Bourne shell by setting certain environment variables...
>
> And believe it or not, I have actually come across installed Unix
> systems where the system shell was csh, and there was no
> bourne-compatible shell installed on the machine. This was no doubt
> due to a bad decision on the part of the guy running the machine, but
> not everyone managing Unix systems has the same level of knowledge,
> skill, etc..
>
> But I take your point: You MOSTLY can write shell scripts that are
> compatible on all Unix systems, IFF you're very careful to only use
> Bourne-compatible syntax. But you have to know what that subset of
> features and syntax is...
>
> Still, these days, it's hard to find a Unix system that doesn't have
> either Perl or Python installed, or at least have them as a
> vendor-provided option. And of course, if you're the sysadmin, you
> can install them yourself, from sources if need be.
>
>
I have been around Unix for many years and I have not seen a system
where there was not a Bourne shell. I also worked on a system for a
client where the client's scripts all had comments at the beginning, and
somehow the scripts invoked the CShell. The client in this case was Bell
labs. They would not modify their scripts with a #! at the beginning.
Most Linux and Unix systems today do use the POSIX shell, but my
training is when writing basic scripts, I do not rely on POSIX.
--
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id:3BC1EB90
PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90
More information about the Discuss
mailing list