[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.



On Sat 16 Apr 2016 at 19:06:42 (-0400), Gene Heskett wrote:
> On Saturday 16 April 2016 14:02:16 Thomas Schmitt wrote:
> > Gene Heskett wrote:
> > > There are too many places where a conditional would be needed
> >
> > The classic way is to use only gestures which are supported by the
> > Bourne shell and to avoid certain peculiarities of some shells.
> > In ./configure scripts of source packages one can see gestures
> > like
> >
> >           if test "x${InMail}" = xgene
> >
> > which avoids to compare empty variable content.
> 
> In normal everyday operation, the variable ${InMail} will not be empty.

That may or may not be a useful observation. However, sod's law
dictates that when it *is* empty, it'll be in five years time when
you've forgotten how and why you converted your script, and you
desparately need it to work _now_.

Going back a step or two:

"This bash script has lived in ~/bin for years, but the mention of
 dash as a replacement for bash made me want to test it with dash by
 changing the bang line to #!/bin/sh, which is of course (this is
 wheezy) a softlink to /bin/dash."

Debian took a decision long ago to make dash the default shell for
*system* scripts. In that sense only, dash replaced bash, and the
replacement took a while because all the bashisms had first to be
removed from those scripts headed by #!/bin/sh. Water under the
bridge now.

Grepping /var/lib/dpkg/info/*.p* can be a quick way of finding
examples of dash's ways and means. However, you're probably wasting
your time converting your own scripts unless you need the efficiency.

And this statement:

"However, I'll go on record as opposing any motions to remove bash,
 the old man on the mountain of cli shells still gets the job done."

is an unfounded fear. The default login shell is bash, as usual.

Cheers,
David.


Reply to: