Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Posted Jan 26, 2011 20:51 UTC (Wed) by rahulsundaram (subscriber, #21946)
Posted Jan 27, 2011 4:38 UTC (Thu) by HelloWorld (guest, #56129)
Posted Jan 27, 2011 5:33 UTC (Thu) by jmm82 (guest, #59425)
Posted Jan 27, 2011 13:45 UTC (Thu) by HelloWorld (guest, #56129)
That probably depends on your definition of portability. While it is theoretically possible to write bourne shell scripts that work on many platforms, almost nobody does because it's just too hard due to all kinds of differences both in the shell implementations and the tools that are available. Larry Wall was right when he said It is easier to port a shell than a shell script.
It is easier to port a shell than a shell script.
So, if you want to write a portable script, use perl. If your unix system doesn't have perl, it's dead anyway. And while perl isn't the be-all and end-all of scripting languages, it is a huge improvement over bourne style shells.
Posted Jan 27, 2011 16:19 UTC (Thu) by jmm82 (guest, #59425)
Perl is not as easy to pipe multiple commands. I wish it was, but it just isn't. Also, in the embedded space microperl might reach the system, but not perl. Also, Perl is not any better to maintain than sh, maybe Python. With BusyBox you can run a lot of scripts with a few changes.
Funny you quote Larry Wall and say Bourne should be replaced by Perl.
Posted Jan 27, 2011 23:03 UTC (Thu) by cmccabe (guest, #60281)
Bourne shell scripts are still the right choice for SHORT (one or two page length) glue scripts. Once you start needing more, something like Ruby or Python is probably the right choice. Perl was really innovative in its day, but starting new projects in Perl is a terrible idea.
Posted Feb 23, 2011 18:53 UTC (Wed) by jrockway (subscriber, #71508)
Honestly, people have written bad Perl in the past, but now they are writing bad Python and Ruby too :)
Posted Feb 23, 2011 22:34 UTC (Wed) by nix (subscriber, #2304)
And I am not the only person this is true of. Perl is a very messy language.
Posted Jan 27, 2011 10:25 UTC (Thu) by mpr22 (subscriber, #60784)
Posted Jan 27, 2011 11:23 UTC (Thu) by djzort (guest, #57189)
How about something that looks like a Makefile? How about hmmm...Python?
Posted Jan 27, 2011 23:06 UTC (Thu) by cmccabe (guest, #60281)
Matt Domsch wrote:
> Yes. We did uncover one or two trivial-to-fix bugs in the Fedora
> initscripts due to this, but that was to be expected. There are no other
> ASCII characters that don't already have several meanings that would make
> for a better separator. In configuration files, the # is usually only
> special at the beginning of a line, not as part of another word, and they
> can always be quoted if necessary.
Posted Jan 31, 2011 5:39 UTC (Mon) by mab (subscriber, #314)
Posted Jan 28, 2011 19:48 UTC (Fri) by smurf (subscriber, #17840)
Hashes in variable values don't even need quoting.
Posted Jan 31, 2011 21:21 UTC (Mon) by lakeland (subscriber, #1157)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds