[Top][All Lists]

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

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

From: Steffen Nurpmeso
Subject: Re: [ ! ! hey ] -> [: too many arguments
Date: Thu, 23 Jun 2022 23:08:04 +0200
User-agent: s-nail v14.9.24-259-ge9cf982228

Chet Ramey wrote in
 |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 ]; then echo du; fi'
 |>    du
 |>    #?0|kent:tmp$ bash -c 'if [ ! ! hey ]; then echo du; fi'
 |>    bash: line 1: [: too many arguments
 |>    #?0|kent:tmp$ busybox.static sh -c 'if [ ! ! hey ]; then echo du; fi'
 |>    du
 |Thanks for the report. This appears to have existed for over thirty years,
 |and you're the first one to report it.

Hey.  For a C programmer things like

  bash -c 'if [ ! hey = hey ]; then echo du; fi'
or even
  bash -c 'if [ ! ! hey = hey ]; then echo du; fi'
  bash -c 'if [ ! false = 1 ]; then echo du; fi'

seem often more strange .. and is handled the same by all above

(P.S.: but mind you, the times when i used to say, give it to me,
if i cannot break it that is a good sign, they have long passed.
You have to walk to stumble that is.

|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]