[ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Steffen Nurpmeso
Hello. I stumbled over a bug in the MUA i maintain, and when checking against what shells do with lonely unary ! i then came to this: #?0|kent:tmp$ dash -c 'if [ ! ! hey ]; then echo du; fi' du #?0|kent:tmp$ bash -c 'if [ ! ! hey ]; then echo du; fi' bash: line 1: [: too many arguments

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in <20220623133946.h72dj%stef...@sdaoden.eu>: ... | #?0|kent:tmp$ bash -c 'if [ ! ! hey ]; then echo du; fi' | bash: line 1: [: too many arguments (5.1.16 that is on CRUX ports/core/bash/Pkgfile ./configure \ --prefix=/usr \ --e

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Chet Ramey
On 6/23/22 9:39 AM, Steffen Nurpmeso wrote: Hello. I stumbled over a bug in the MUA i maintain, and when checking against what shells do with lonely unary ! i then came to this: #?0|kent:tmp$ dash -c 'if [ ! ! hey ]; then echo du; fi' du #?0|kent:tmp$ bash -c 'if [ ! ! hey ]; then echo

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Steffen Nurpmeso
Chet Ramey wrote in <4169f2cd-d81c-29b7-918c-156b447c5...@case.edu>: |On 6/23/22 9:39 AM, Steffen Nurpmeso wrote: |> I stumbled over a bug in the MUA i maintain, and when checking |> against what shells do with lonely unary ! i then came to this: |> |>#?0|kent:tmp$ dash -c 'if [ ! ! hey

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Chet Ramey
On 6/23/22 5:08 PM, Steffen Nurpmeso wrote: Chet Ramey wrote in <4169f2cd-d81c-29b7-918c-156b447c5...@case.edu>: |On 6/23/22 9:39 AM, Steffen Nurpmeso wrote: |> I stumbled over a bug in the MUA i maintain, and when checking |> against what shells do with lonely unary ! i then came to this

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Emanuele Torre
On 22/06/23 11:08 PM, Steffen Nurpmeso wrote: > or even > bash -c 'if [ ! ! hey = hey ]; then echo du; fi' > bash -c 'if [ ! false = 1 ]; then echo du; fi' `! ! hey = hey' is the same as `! ( ! ( hey = hey ) )', so "not not true => true". It probably works correctly because `! ! hey = hey' are

Re: [ ! ! hey ] -> [: too many arguments

2022-06-23 Thread Greg Wooledge
On Thu, Jun 23, 2022 at 05:58:23PM -0400, Chet Ramey wrote: > On 6/23/22 5:08 PM, Steffen Nurpmeso wrote: > >bash -c 'if [ ! ! hey = hey ]; then echo du; fi' > Sure. This one isn't a common idiom for shell programmers, apparently. I've seen it used in a math context, inside PS1. Like so: co