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?

3 of 388 comments (clear)

  1. Re:a real bourne shell by mangu · · Score: 1, Flamebait

    Yeah, and put ONE and ONLY ONE manager for email and ONLY ONE for news and ONLY ONE for irc and ONLY ONE for icq? If you are a guru and want choice, well, then go and download your alternative package from the net, but do not force newbies to choose between mutt and pine and whatever.

    And put an expert system for running tksysv that doesn't fuck up the order in which daemons must be started up and shut down. And DEBUG that fucking apt-get thing, so one can update a system. And don't invent a buggy GRUB when LILO is working just fine.

    I've tried almost every distro since Yggdrasil came along, and I believe in the good old school that says one must debug the fucking thing before putting more "improvements" and "features" in.

  2. Re:No other OS? by OmegaDan · · Score: 1, Flamebait

    bash maybe in an addon pack .. but the default installs of 2.7 and lower definatley had no bash ... Infact, a default 2.7 install is just *baren* as im sure your aware. I have done 20 or so solaris installs, and I can tell you my least favorite part is bootstraping the machine to the point that my config scripts can take over

    (to me this is:
    * mount /usr/local (network),
    * set paths so usr/local software overides the default solaris stuff (a couple of the utils like tar are strange)
    * install bash/ssh (and libs)/update tcsh (ok, ssh isn't necessary, but its only a couple extra keystrokes)

    Now your machine is on the network, you've got bash and the paths are setup to use gnu utilities and not those fucked up ones that come with solaris -- *now* your ready to run your auto-configure script.

    Why can't the script setup this by hand? Well, you need bash as an interpreter cuz the sh it comes with is pretty fucked up -- and theres *no* way to get the script on the computer -- recall until recently sparc machines *didn't come with floppies* hell, most of our ultra1's (don't laugh!) don't even have cdroms (I have a spare cdrom I drag from machine to machine when I need to install (but you've gotta open up the machine anyways to set the jumper allow the installer to flash the bios ...)

    I guess I could make a bootstrapping cdrom ...

  3. Re:bash as /bin/sh by Xane · · Score: 1, Flamebait

    odpierdol siê You Ameriocentric jerk. I don't think a country that manages to educate virtually all of it's population to the point of literacy and offers every citzen the RIGHT of free education up to and including a PhD is deserving of your scorn. Sure we charged out with horses against tanks 90 yrs ago but 180 yrs ago your capitol got razed by Canada, so what. Maybe your American education didn't bother to explain either of those two bits of history. Maybe you just insulted 40 millon people for being stupid and don't even know why you have that prejudice. What do Polskas know about Linux?...What do Americans know about the rest of the world? gupia pizda