27 августа 2016 г. 11:44:33 CEST, Erik Trimble <erik.trim...@netdemons.com> пишет: >Well, > >Since a significant amount of Linux distros use Dash instead of Bash >for >/bin/sh, and the large majority of Solaris/IllumOS system scripts >depend on >a 100% Bourne-compatible /bin/sh (of which Bash is *not*), I'd say >fix >the shell script, rather than open that particular can of worms. > >Frankly, this is lazy coding on the part of the App Developer, since >/bin/sh on ANY Unix-ish system other than Linux has NEVER been Bash. >Bash >was used in Linux for quite awhile due to (a) Lazy Distro maintainers, >and >(b) lack of a real, suitable, pure unencumbered Bourne Shell. That >was >fixed almost a decade ago, though, so continued reliance that /bin/sh >-> >bash is just very sloppy coding. > >Also, just to be clear: the scripts seem to wanting Bash, which is NOT >a >100% compatible Bourne shell (of which ksh *is*). > >-Erik > > >On Sat, Aug 27, 2016 at 1:37 AM, Gabriele Bulfon <gbul...@sonicle.com> >wrote: > >> Hi, >> >> recently I've been driving mad porting a linux software containing a >lot >> of shells, failing with poor debugging infos. >> At the end, I found they were all using /bin/sh but required a >compatible >> Bourne shell. >> This will require me to patch hundreds of shell to point to /bin/bash >> instead of /bin/sh >> >> So my question is : do we really need /bin/sh to point to ksh in >2016? >> What do I risk by changing its link to /bin/bash? >> >> Gabriele >> >> ------------------------------------------------------------ >> ---------------------------- >> *Sonicle S.r.l. *: http://www.sonicle.com >> *Music: *http://www.gabrielebulfon.com >> *Quantum Mechanics : *http://www.cdbaby.com/cd/gabrielebulfon >> *illumos-discuss* | Archives >> <https://www.listbox.com/member/archive/182180/=now> >> <https://www.listbox.com/member/archive/rss/182180/28364917-eb1c989b> >| >> Modify >> <https://www.listbox.com/member/?&> >> Your Subscription <http://www.listbox.com> >> > >
I'd also say that sometimes I too write specifically bash scripts - but a) they say so in shebang and/or re-exec $0 by bash early on (e.g. if these are initscripts that Solaris would anyway start with system shell and ignore the shebang); b) there's a reason to do so e.g. on embedded/slow systems where we want to minimize forking and use in-shell regex support, etc. For those systems it is also more predictable and so even more portable than using a random external grep, awk, sed, test `[` etc. implementation from GNU here busybox there something different elsewhere. But then it is not much more different (in constraints and expectations) than writing for a specific interpreter like perl or python or any other language. Except bash+deps is more compact than most of those alternatives. Jim -- Typos courtesy of K-9 Mail on my Samsung Android ------------------------------------------- illumos-discuss Archives: https://www.listbox.com/member/archive/182180/=now RSS Feed: https://www.listbox.com/member/archive/rss/182180/21175430-2e6923be Modify Your Subscription: https://www.listbox.com/member/?member_id=21175430&id_secret=21175430-6a77cda4 Powered by Listbox: http://www.listbox.com