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

2016-04-22 Thread David Wright
On Fri 22 Apr 2016 at 14:19:11 (+1000), Andrew McGlashan wrote: > On 17/04/2016 3:11 AM, Aero Maxx wrote: > >> bin/mailwatcher > /dev/null 2>&1 & > > Perhaps better still... > bin/mailwatcher >& /dev/null & ... or even bin/mailwatcher &> /dev/null & which is generally safer. > Without specif

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

2016-04-22 Thread Clive Standbridge
> > Perhaps better still... > > bin/mailwatcher >& /dev/null & > > > I hadn't thought about that particular incantation. It is one of the > strengths of bash (and some other shells) that there are several > different incantations that achieve similar or same results. You get > to speak the diale

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

2016-04-22 Thread Gene Heskett
On Friday 22 April 2016 00:19:11 Andrew McGlashan wrote: > On 17/04/2016 3:11 AM, Aero Maxx wrote: > >> bin/mailwatcher > /dev/null 2>&1 & > > Perhaps better still... > bin/mailwatcher >& /dev/null & > > Without specifying STDOUT or STDERR you get both. > > ;-) > > AndrewM I'll try that come ne

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

2016-04-21 Thread Michael Milliman
On 04/21/2016 11:19 PM, Andrew McGlashan wrote: On 17/04/2016 3:11 AM, Aero Maxx wrote: bin/mailwatcher > /dev/null 2>&1 & Perhaps better still... bin/mailwatcher >& /dev/null & I hadn't thought about that particular incantation. It is one of the strengths of bash (and some other shells

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

2016-04-21 Thread Andrew McGlashan
On 17/04/2016 3:11 AM, Aero Maxx wrote: >> bin/mailwatcher > /dev/null 2>&1 & Perhaps better still... bin/mailwatcher >& /dev/null & Without specifying STDOUT or STDERR you get both. ;-) AndrewM signature.asc Description: OpenPGP digital signature

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

2016-04-18 Thread Gene Heskett
On Monday 18 April 2016 09:49:29 David Wright wrote: > On Sun 17 Apr 2016 at 00:41:03 (-0400), Gene Heskett wrote: > > On Saturday 16 April 2016 22:18:34 David Wright wrote: > > > On Sat 16 Apr 2016 at 19:06:42 (-0400), Gene Heskett wrote: > > > > On Saturday 16 April 2016 14:02:16 Thomas Schmitt

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

2016-04-18 Thread David Wright
On Sun 17 Apr 2016 at 00:41:03 (-0400), Gene Heskett wrote: > On Saturday 16 April 2016 22:18:34 David Wright wrote: > > 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 man

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

2016-04-17 Thread Jeremy Nicoll
On Sun, 17 Apr 2016, at 14:28, Thomas Schmitt wrote: > Let's assume a subordinate script ... Thank-you! That's devious. -- Jeremy Nicoll - my opinions are my own.

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

2016-04-17 Thread Thomas Schmitt
Hi, Gene Heskett wrote: > they do not have enough voltage > across the oxide film to keep it "formed" so the oxide slowly reverts as > its in an oxygen free environment I always preferred math over chemistry. > So I should change my single quotes to double-quotes. Rather not. At least not as

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

2016-04-17 Thread Michael Milliman
On 04/17/2016 08:28 AM, Thomas Schmitt wrote: Hi, Jeremy Nicoll wrote: would anyone ever code: bin/mailwatcher 2>&1 >/dev/null when surely all they need is bin/mailwatcher >/dev/null Interesting question. (Like what is the use case of cat(1) ?) Surely this is one of the less useful varia

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

2016-04-17 Thread Thomas Schmitt
Hi, Jeremy Nicoll wrote: > would anyone ever code: > bin/mailwatcher 2>&1 >/dev/null > when surely all they need is > bin/mailwatcher >/dev/null Interesting question. (Like what is the use case of cat(1) ?) Surely this is one of the less useful variations of the rules for redirection. Let's a

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

2016-04-17 Thread Michael Milliman
On 04/17/2016 03:21 AM, Jeremy Nicoll wrote: On Sun, 17 Apr 2016, at 07:25, Michael Milliman wrote: Yes, this is the correct incantation. The difference is very subtle. With ... 2>&1 >/dev/null, the error output is redirected to be the same as the standard output, and then the standard outpu

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

2016-04-17 Thread Gene Heskett
On Sunday 17 April 2016 08:06:13 Thomas Schmitt wrote: > Hi, > > [Second try to send this mail. Looks like lists.debian.org had a > few minutes of inconsciousness. No reply on ping or https.] > > Gene Heskett wrote: > > In normal everyday operation, the variable ${InMail} will not be > > empty. >

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

2016-04-17 Thread Jeremy Nicoll
On Sun, 17 Apr 2016, at 12:46, Thomas Schmitt wrote: > Jeremy Nicoll wrote: > > Why is the "2>&1" part needed? Wouldn't stderr go to the terminal by > > default. > > Goal is to redirect both to /dev/null. > > So these would do: > > bin/mailwatcher 2>/dev/null >/dev/null & > > bin/mailwa

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

2016-04-17 Thread Thomas Schmitt
Hi, Gene Heskett wrote: > In normal everyday operation, the variable ${InMail} will not be empty. Well, normally the 10 uF capacitors suffice for the projected life time of the dishwasher. :)) The bashism "[[ ${InMail} = 'gene' ]]" hides the pitfall that whitespace in a variable will normally y

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

2016-04-17 Thread Thomas Schmitt
Hi, [Second try to send this mail. Looks like lists.debian.org had a few minutes of inconsciousness. No reply on ping or https.] Gene Heskett wrote: > In normal everyday operation, the variable ${InMail} will not be empty. Well, normally the 10 uF capacitors suffice for the projected life time

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

2016-04-17 Thread Thomas Schmitt
Hi, Jeremy Nicoll wrote: > Why is the "2>&1" part needed? Wouldn't stderr go to the terminal by > default. Goal is to redirect both to /dev/null. So these would do: bin/mailwatcher 2>/dev/null >/dev/null & bin/mailwatcher >/dev/null 2>&1 & But as Michael Milliman pointed out, bin/ma

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

2016-04-17 Thread Gene Heskett
On Sunday 17 April 2016 02:25:01 Michael Milliman wrote: > On 04/16/2016 12:11 PM, Aero Maxx wrote: > > On 16/04/2016 17:45, Gene Heskett wrote: > >> On Saturday 16 April 2016 12:01:28 Aero Maxx wrote: > >>> On 16/04/2016 16:23, Gene Heskett wrote: > But when I run it with dash, it doesn't se

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

2016-04-17 Thread Jeremy Nicoll
On Sun, 17 Apr 2016, at 07:25, Michael Milliman wrote: > Yes, this is the correct incantation. The difference is very subtle. > With ... 2>&1 >/dev/null, the error output is redirected to be the same > as the standard output, and then the standard output is redirected to > /dev/null -- leavin

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

2016-04-16 Thread Michael Milliman
On 04/16/2016 12:11 PM, Aero Maxx wrote: On 16/04/2016 17:45, Gene Heskett wrote: On Saturday 16 April 2016 12:01:28 Aero Maxx wrote: On 16/04/2016 16:23, Gene Heskett wrote: But when I run it with dash, it doesn't seem to work right, and spams the terminal with its error messages. One tha

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

2016-04-16 Thread Gene Heskett
On Saturday 16 April 2016 22:18:34 David Wright wrote: > 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

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

2016-04-16 Thread David Wright
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 sh

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

2016-04-16 Thread Gene Heskett
On Saturday 16 April 2016 14:02:16 Thomas Schmitt wrote: > Hi, > > Gene Heskett wrote: > > if [[ ${InMail} = 'gene' ]] > > test(1) is supposed to be portable > > if test "${InMail}" = 'gene' > Thats slightly different, printed for tomorrows experiments. Thank you. I need to rebo

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

2016-04-16 Thread Gene Heskett
On Saturday 16 April 2016 13:11:54 Aero Maxx wrote: > On 16/04/2016 17:45, Gene Heskett wrote: > > On Saturday 16 April 2016 12:01:28 Aero Maxx wrote: > >> On 16/04/2016 16:23, Gene Heskett wrote: > >>> But when I run it with dash, it doesn't seem to work right, and > >>> spams the terminal with i

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

2016-04-16 Thread Thomas Schmitt
Hi, Gene Heskett wrote: > if [[ ${InMail} = 'gene' ]] test(1) is supposed to be portable if test "${InMail}" = 'gene' > 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

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

2016-04-16 Thread Linux-Fan
[Sat, 16 Apr 2016 13:07:38 -0400] Gene Heskett 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-

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

2016-04-16 Thread Aero Maxx
On 16/04/2016 17:45, Gene Heskett wrote: On Saturday 16 April 2016 12:01:28 Aero Maxx wrote: On 16/04/2016 16:23, Gene Heskett wrote: But when I run it with dash, it doesn't seem to work right, and spams the terminal with its error messages. One that appears to kill its function is the bashis

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

2016-04-16 Thread Gene Heskett
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

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

2016-04-16 Thread Gene Heskett
On Saturday 16 April 2016 12:01:28 Aero Maxx wrote: > On 16/04/2016 16:23, Gene Heskett wrote: > > But when I run it with dash, it doesn't seem to work right, and > > spams the terminal with its error messages. One that appears to > > kill its function is the bashism of using [[ ]] to surround st

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

2016-04-16 Thread Sven Joachim
On 2016-04-16 11:23 -0400, Gene Heskett wrote: > 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. FWIW, d

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

2016-04-16 Thread Aero Maxx
On 16/04/2016 16:23, Gene Heskett wrote: But when I run it with dash, it doesn't seem to work right, and spams the terminal with its error messages. One that appears to kill its function is the bashism of using [[ ]] to surround string variables, reported like this: bin/mailwatcher: 64: bin/mail

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

2016-04-16 Thread Gene Heskett
Greetings; 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. I am launching it with this command as I don't want