[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: My script almost works but spams the terminal its launched from if useing dash.



[Sat, 16 Apr 2016 13:07:38 -0400] Gene Heskett <gheskett@shentel.net>
wrote:
> On Saturday 16 April 2016 12:44:55 Sven Joachim wrote:
> >
> > https://wiki.ubuntu.com/DashAsBinSh has some information how to make
> > scripts portable.  The checkbashisms command in the devscripts
> > package can help you detect common non-portable constructions in
> > your scripts.
> >
> > Cheers,
> >        Sven
> 
> A bookmarked now, much better explanatory link, thank you Sven.

In addition, I recommend consulting the standard whenever doubt arises:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html

... because there is a lot of outdated information on what is POSIX and
what is not. Fortunately, The Ubuntu Wiki link given above seems to be
OK.

> I think for my stuff, I should export the value of /bin/sh, write a 
> wrapper script to determine what /bin/sh is, and run the correct
> script to get the identical wanted functionality based on the value
> of the export.  There are too many places where a conditional would
> be needed so it would use command A or command B, and thats going to
> slow it down much more than just re-writing it into 2 scripts and
> running the correct one w/o all that gingerbread & bloat.

[...]

As far as I understand, just about all scripts which work under dash
also work under bash without changes. If your script is compatible
with dash, it does not need to check if it is running under bash,
because that will ``just work''. This means: If you do the work to port
the scripts to dash, you will likely not have to maintain a separate
version for bash.

HTH
Linux-Fan

-- 
http://masysma.lima-city.de/

Attachment: pgpzuiICIg3t9.pgp
Description: OpenPGP digital signature


Reply to: