Re: Return from function depending on number of parameters

2020-07-04 Thread Chris Elvidge
On 03/07/2020 10:39 pm, Lawrence Velázquez wrote: On Jul 3, 2020, at 2:00 PM, Chris Elvidge wrote: However 'N=0; echo $((!$N))' gives an error at the bash prompt. 'echo $[!$N]' echo's 1 as expected. My question - is $[...] actually obsolete? It might tell you something that $[...] is not

Re: Return from function depending on number of parameters

2020-07-04 Thread Chris Elvidge
On 03/07/2020 11:16 pm, Eli Schwartz wrote: On 7/3/20 2:00 PM, Chris Elvidge wrote: I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no parameters given to function. Tested in a bash script 'exit $((!$#)) / $[!$#]' - both work. 'echo $((!$#)) / $[!$#]' - both echo 1 when

Re: Return from function depending on number of parameters

2020-07-04 Thread pepa65
On 04/07/2020 04.39, Lawrence Velázquez wrote: > It might tell you something that $[...] is not even mentioned in > the man page for bash 3.2.57, which is decidedly not the current > version. About that, is it for sure that $[] is going to be obsoleted/removed in the future? I happened to use it r

Re: Return from function depending on number of parameters

2020-07-04 Thread Oğuz
4 Temmuz 2020 Cumartesi tarihinde pepa65 yazdı: > On 04/07/2020 04.39, Lawrence Velázquez wrote: > > It might tell you something that $[...] is not even mentioned in > > the man page for bash 3.2.57, which is decidedly not the current > > version. > > About that, is it for sure that $[] is going

Re: Return from function depending on number of parameters

2020-07-04 Thread Chris Elvidge
On 03/07/2020 10:39 pm, Lawrence Velázquez wrote: On Jul 3, 2020, at 2:00 PM, Chris Elvidge wrote: However 'N=0; echo $((!$N))' gives an error at the bash prompt. 'echo $[!$N]' echo's 1 as expected. My question - is $[...] actually obsolete? It might tell you something that $[...] is not eve

Re: Return from function depending on number of parameters

2020-07-04 Thread Chris Elvidge
On 03/07/2020 11:16 pm, Eli Schwartz wrote: On 7/3/20 2:00 PM, Chris Elvidge wrote: I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no parameters given to function. Tested in a bash script 'exit $((!$#)) / $[!$#]' - both work. 'echo $((!$#)) / $[!$#]' - both echo 1 when

Re: Return from function depending on number of parameters

2020-07-04 Thread Lawrence Velázquez
> On Jul 4, 2020, at 8:12 AM, pepa65 wrote: > > On 04/07/2020 04.39, Lawrence Velázquez wrote: >> It might tell you something that $[...] is not even mentioned in >> the man page for bash 3.2.57, which is decidedly not the current >> version. > > About that, is it for sure that $[] is going to b

Re: foo | tee /dev/stderr | bar # << thanks!

2020-07-04 Thread bug-bash
Hi Lawrence: On Fri 7/3/20 14:03 -0400 =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= wrote: >What's wrong with `foo | tee /dev/stderr | bar`? Perfect! This morning I had thought of foo | tee >(cat >&2) | bar but your soln is simplier. I assume /dev/stderr is on non linux UNIX also. -- thanks-you!,

Re: Return from function depending on number of parameters

2020-07-04 Thread Eli Schwartz
On 7/4/20 7:54 AM, Chris Elvidge wrote: > On 03/07/2020 11:16 pm, Eli Schwartz wrote: >> On 7/3/20 2:00 PM, Chris Elvidge wrote: >>> I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no >>> parameters given to function. >>> >>> Tested in a bash script 'exit $((!$#)) / $[!$#]' -