LWN.net Logo

Shell metacharacters

Shell metacharacters

Posted Jan 27, 2011 4:38 UTC (Thu) by HelloWorld (guest, #56129)
In reply to: Shell metacharacters by cesarb
Parent article: Domsch: Consistent Network Device Naming coming to Fedora 15

It is, and that's a Good Thing. Bourne-style shell scripting needs to die, and the sooner people realize that, the better.


(Log in to post comments)

Shell metacharacters

Posted Jan 27, 2011 5:33 UTC (Thu) by jmm82 (guest, #59425) [Link]

Bourne-style shell scripting may be one of the most portable languages across all unix systems. We should probably rewrite auto-tools and convert every build system in the world to a new language?

Shell metacharacters

Posted Jan 27, 2011 13:45 UTC (Thu) by HelloWorld (guest, #56129) [Link]

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.

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.

Shell metacharacters

Posted Jan 27, 2011 16:19 UTC (Thu) by jmm82 (guest, #59425) [Link]

Hence auto-tools, what do you think "./configure" is doing?

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.

Shell metacharacters

Posted Jan 27, 2011 23:03 UTC (Thu) by cmccabe (guest, #60281) [Link]

Perl is not a shell. Therefore Perl can never replace the bourne shell.

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.

Shell metacharacters

Posted Feb 23, 2011 18:53 UTC (Wed) by jrockway (subscriber, #71508) [Link]

What's wrong with Perl for new projects? New modern object systems like Moose? 20,000 free distributions on CPAN?

Honestly, people have written bad Perl in the past, but now they are writing bad Python and Ruby too :)

Shell metacharacters

Posted Feb 23, 2011 22:34 UTC (Wed) by nix (subscriber, #2304) [Link]

Honestly, it's much easier to write bad Perl than bad Python. I'm a structure fanatic: my C, Python and Lua is structured as all hell. But I can't make my Perl look neat or structured no matter how hard I try: it disintegrates into a mess regardless.

And I am not the only person this is true of. Perl is a very messy language.

Shell metacharacters

Posted Jan 27, 2011 10:25 UTC (Thu) by mpr22 (subscriber, #60784) [Link]

Feel free to propose a ubiquitous, reliable alternative that makes every useful thing that is simple in Bourne-style shells no more complex than it is in Bourne-style shells.

Shell metacharacters

Posted Jan 27, 2011 11:23 UTC (Thu) by djzort (guest, #57189) [Link]

"It is, and that's a Good Thing. Bourne-style shell scripting needs to die, and the sooner people realize that, the better."

How about something that looks like a Makefile? How about hmmm...Python?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds