Slashdot Mirror


A Real Bourne Shell for Linux?

the_code_poet asks: "I'm a lead developer for a software development company, and one of my responsibilities has been writing an installer for our product (of which Linux is one of the platforms). In keeping with UNIX tradition, the installer is written in shell (thats /bin/sh), but as many of you know there is no Bourne shell for Linux - only bash. This has caused inconsistencies (mostly bugs in bash) when writing a generic UNIX sh script that works fine on commerical *NIX's." For a semi-complete list of differences between bash and sh, you will want to check out section C1 of the Bourne Again Shell FAQ. To be honest, I have yet to run into much trouble with a script starting with #!/bin/sh with /bin/bash, and I've been using the latter for years. If any of you have had problems related to this, please tell us what the problem was and how you solved it. Also: would anyone out there be interested in writing a real Bourne Shell for Linux?

"On every distro I've ever seen /bin/sh is just a soft link to /bin/bash. If bash is invoked with sh as its name (argv[0]) then its supposed to act like Bourne - but that just doesnt happen (for example: export FOO=bar is *not* valid Bourne shell syntax, you must say FOO=bar; export FOO)

Do you think that the startup scripts for most distributions would break because, even though they say
#!/bin/sh at the top, they REALLY mean #!/bin/bash?

Given that there is no real Bourne shell for Linux, and that bash has an exhorbitant file size. Quoting bash's man page, here: '...it's too big and too slow' for something that is to be used as the defacto-standard shell for scripting, do you think its a worthy venture to set out to write a small, tight, pure Bourne shell?

*asbestos disclaimer*: This has nothing to with Bash as an interactive user shell and has nothing to do with a holy war over who's favorite shell is better than whomever's."

While doing a small bit of research on this question, I noted there was another Bourn-compatible shell out there called "ash", yet it's billed as doing "some things better and some things worse than bash". Does anyone use it, and find it better than bash for their shell scripting needs?

13 of 388 comments (clear)

  1. Not "sh" for Linux... by Jetson · · Score: 0, Troll

    I'd rather see bash on HP/UX, etc. Why should we take a giant leap backward for their sake?

  2. Re:How linux is still an inferior desktop OS by Anonymous Coward · · Score: -1, Troll

    STANDARDIZED TROLL REPLY FORM
    (original by Spootnik)

    I took exception to your recent _X_ comment to __slashdot______

    ___ story

    It was (check all that apply):

    ___ first post.
    ___ ascii art.
    _X_ karma whore.
    ___ modded on crack.
    ___ counter lameness filter.
    ___ racist.
    ___ raging homosexual.
    _X_ much longer than any worthwhile thought of which you may be capable.

    Your attention is drawn to the fact that:

    _X_ what you posted/said has been done before.
    (Mark only if above checked)
    _X_ Not only that, it was also done better the last time.
    ___ your post/letter was a pathetic imitation of ____________________.
    (net.personality)
    ___ your post/mail originated on AOL.
    ___ your post/mail originated from the anon service
    ___ your post/mail originated from a commercial service unwise enough to
    take your money
    (Mark only if above checked)
    ___ you felt this gave you a license to be a 'tard
    (Mark only if above checked)
    ___ your stupidity will be reported to jamie@mccarthy.vg per
    the crackhead disclaimer under "excessive bad posting"
    _X_ your post referred to the slashdot as a reliable source of information.

    ___ you posted a boring anecdote about your nerdy behaviours.
    ___ you posted a request for sexual favor.
    ___ you posted a pointer to goatse.cx
    ___ you asked for dirty pictures.
    ___ you posted a personal ad to a personal web site
    ___ you posted a request for a Beowulf cluster of that.
    ___ you posted a request for Nathalie Portman
    ___ Naked and petrified.
    ___ you poored hot grits down your pants.
    ___ you are not wearing pants.

    ___ your post contained numerous spelling errors.
    ___ including the subject line
    _X_ your post contained multiple grammatical errors.
    ___ YOUR POST CONTAINED EXCESSIVE CAPITALIZATION AND/OR PUNCTUATION!!!!!
    ___ you posted a spelling and/or grammar flame.
    (Mark only if above checked)
    ___ and you made spelling and/or grammatical errors.
    _X_ you have a lame login name.
    ___ you quoted an article in followup and added no new text.
    ___ you quoted an article in followup and only added ___ lines of text.
    ___ you posted an identical article multiple times.
    ___ you apologized claiming a problem with your brain.
    ___ you followed up a spam or a chain letter and included it in its entirety.
    ___ you quoted an article in followup and only added the line "Me, too!!!"
    ___ you predicted the "Imminent Death of BSD".
    ___ you flamed someone who has mentionned the word "Microsoft".
    _X_ you filthy hippy bragged about the all mighty Linux.
    _X_ you failed to read the article.
    ___ your .sig is longer than four lines.
    (Mark only if above checked)
    ___ And the lameness filter truncated it.
    ___ your .sig is ridiculous because (check all that apply):
    ___ you listed ___ email addresses for trolls to use in prank posts.
    ___ you included a stupid disclaimer.
    (Mark only if above also)
    ___ your pathetic attempt at being witty in the disclaimer failed.
    (Mark only if above also)
    ___ Miserably.
    ___ you included:
    (Mark all that apply)
    ___ a stupid self-quote.
    ___ a stupid quote from 1st amendment.
    ___ a Star Trek quote.
    ___ a lameass joke.
    ___ a reference to Osama Bin Laden.

    Furthermore:

    ___ You have greatly misunderstood the purpose of ________________________.
    ___ You have greatly misunderstood the purpose of masturbating.
    _X_ You are a loser.
    ___ You must have spent your entire life in a skinner box to be this clueless.
    ___ *plonk*
    ___ This has been pointed out to you before.
    ___ Propz to all my dead homiez.

    _X_ It is recommended that you:
    (Mark all that apply)
    ___ stick to Adequacy and come back when you've grown up.
    ___ find a volcano and throw yourself in.
    ___ get a gun and shoot yourself.
    ___ stop reading Salshdot news and get a life.
    _X_ stop posting comments and get a life.
    ___ consume excrement.
    ___ consume excrement and thus expire.

    Additional comments:

    None needed.

  3. Bourne, Smourne by Anonymous Coward · · Score: -1, Troll

    Who cares? Linux is dead anyway.

  4. Let *sh die! by Anonymous Coward · · Score: -1, Troll

    The shell scripting languages need to die. I find a more enlightened approach is to integrate a full interpreted language like perl or python into a shell-like environment. I like what psh is doing in this regards - work just like you are in a traditional shell, but have available all the facillities of perl.

  5. The solution is... by aminorex · · Score: 0, Troll

    ...submit a fucking patch, dickwad.
    Sheesh. Some people's kids!

    --
    -I like my women like I like my tea: green-
  6. a real bourne shell by super-flex-o-matic · · Score: 0, Troll

    is the last thing linux needs to succeed at the moment.

    so why ask for people to write one, if it lacks in totally different places.

    a question from me maybe:
    is it possible to scale linux down, put (insert the most user-friendly windowmanager here) in it, and keep all those server stuff (appache, bind etc.) out put it on one cd, make an easy installer with good hardware detection, make a framework that 3rd party software vendors can work on without colliding with the GPL's issues, eye candy - multiuser support. and ease the pain of windows users.

    ah ya, and dont forget to write a script that makes the delete and backspace buttons work under every terminal-emulator.

  7. Can you blame 'em? by imrdkl · · Score: 0, Troll

    For making a shell that is incompatible with non-free OS?

  8. (C) Copyright 2001 - Anonymous Coward by Anonymous Coward · · Score: -1, Troll

    I forgot to mention no logged in luser can use this troll, it's for AC's only.

  9. Re:Why is Linux dead? by Anonymous Coward · · Score: -1, Troll

    Because eventually you guys will have to move out of your parents basement. You socialists just keep making the same thing over and over again. No innovation. Why don't you use FreeBSD.

  10. Re:Did you even read the complaint? by Anonymous Coward · · Score: -1, Troll
    Why the fuck would you EVER be writing a shell script on a box other than the one you are going to run it on!?

    If you sit down a workstation to write a scipt for a server with a different OS, step one is to SSH into the server and write it in the environment for which it is intended!

    It's a script. It's not like you are writing an application, which needs to be portable... unless you are, in which case, why the fuck are you using shell scripting!?

  11. Re:What vacuum are you living in? (ksh and zsh) by MMMMMMMMMMMMMMMMMMMM · · Score: -1, Troll
    Your analogy is flawed. Asking about ksh to the bash folks is like asking if the United States are the unquestioned pinnacle to the Talibans. Don't hold your breath for an unanimous answer. In fact, screw them, USA are the pinnacle, no question about it. We should bomb all other nations, including France.


    MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMM

  12. Re:It's a non-issue. by ink · · Score: 1, Troll
    Adding features is good, but keep them out of the thing that claims to be the standard version of the language. /bin/sh should be a POSIX shell, period.

    So which is it that you people want? A POSIX shell or a Bourne shell? They are mutually exclusive. Bash and ksh are both POSIX shells, but the Bourne shell is most definately not. As far as I'm concerned, POSIX can go jump in a lake anyway -- but that's another rant for another day.

    --
    The wheel is turning, but the hamster is dead.
  13. Windows XP by Anonymous Coward · · Score: -1, Troll

    Fatal Error: Use Windows XP