Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I got a question for ya. Ya got a minute?" -- two programmers passing in the hall


devel / comp.unix.shell / [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

SubjectAuthor
* [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1hongy...@gmail.com
`* Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1Josef Moellers
 `* Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1Janis Papanagnou
  `* Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1hongy...@gmail.com
   `- Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1Janis Papanagnou

1
[ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

<66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4571&group=comp.unix.shell#4571

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:44cc:: with SMTP id r195mr39995981qka.77.1636004037717;
Wed, 03 Nov 2021 22:33:57 -0700 (PDT)
X-Received: by 2002:ae9:ef05:: with SMTP id d5mr1057173qkg.357.1636004037570;
Wed, 03 Nov 2021 22:33:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 3 Nov 2021 22:33:57 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=47.241.171.246; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 47.241.171.246
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
Subject: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1
!= "frpc" ]]
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 04 Nov 2021 05:33:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Thu, 4 Nov 2021 05:33 UTC

In bash script, both of the following usages are valid:

[ $1 != "frps" -a $1 != "frpc" ]
[[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

Which is preferable?

Regards,
HZ

Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

<iuhj0mFrm03U1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4574&group=comp.unix.shell#4574

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: josef.mo...@invalid.invalid (Josef Moellers)
Newsgroups: comp.unix.shell
Subject: Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1
!= "frpc" ]]
Date: Thu, 4 Nov 2021 09:13:10 +0100
Lines: 16
Message-ID: <iuhj0mFrm03U1@mid.individual.net>
References: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net F4L7UZLbHhZaCgSo4zd7TwzPku3DUsEBIVJjeUh1o31Cr2729Z
Cancel-Lock: sha1:e4Pcfl05vxWl/nwLFyuzS9A7s20=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
Content-Language: en-US
 by: Josef Moellers - Thu, 4 Nov 2021 08:13 UTC

On 04.11.21 06:33, hongy...@gmail.com wrote:
> In bash script, both of the following usages are valid:
>
> [ $1 != "frps" -a $1 != "frpc" ]
> [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]
>
> Which is preferable?

The one which is most easily understandable.

In my (40+ years) experience this beats just about EVERTHING ELSE, apart
from maybe EXTREME performance differences and/or local conventions.
If you look at the code 3 months from now (or maybe even longer, say
tomorrow) and STILL understand it, it is fine.

Josef

Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

<sm09pp$86t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4575&group=comp.unix.shell#4575

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1
!= "frpc" ]]
Date: Thu, 4 Nov 2021 10:40:09 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <sm09pp$86t$1@dont-email.me>
References: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
<iuhj0mFrm03U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 4 Nov 2021 09:40:09 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="cad4fdccaaf212528dbffc2421b81430";
logging-data="8413"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VUoLa7ybjJmxiOt17P4mI"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:A+ypXwDOyYv+Dr0lBiBXQ5UwE00=
In-Reply-To: <iuhj0mFrm03U1@mid.individual.net>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 4 Nov 2021 09:40 UTC

On 04.11.2021 09:13, Josef Moellers wrote:
> On 04.11.21 06:33, hongy...@gmail.com wrote:
>> In bash script, both of the following usages are valid:
>>
>> [ $1 != "frps" -a $1 != "frpc" ]
>> [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]
>>
>> Which is preferable?

Depending on the actual requirements (portability anyone?), probably
none of these.

For the first case; POSIX: ">4 arguments: The results are unspecified."
(BTW: Why did you quote the constant literals but not the variables?)

If you don't care about portability and standards use [[...]] .

Many folks forget that we can formulate (even regexp-)comparisons also
with the [standard] 'case' construct

case $1 in (frps|frpc) ;; (*) ... ; esac

>
> The one which is most easily understandable.

....and which shows the least surprises (generally and in your context).

Janis

Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

<22d60aea-a441-4a62-a03e-a9c3e050362fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4577&group=comp.unix.shell#4577

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:b781:: with SMTP id h123mr12700944qkf.491.1636024886251;
Thu, 04 Nov 2021 04:21:26 -0700 (PDT)
X-Received: by 2002:a05:622a:1208:: with SMTP id y8mr43584969qtx.214.1636024886098;
Thu, 04 Nov 2021 04:21:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 4 Nov 2021 04:21:25 -0700 (PDT)
In-Reply-To: <sm09pp$86t$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=143.198.81.107; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 143.198.81.107
References: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
<iuhj0mFrm03U1@mid.individual.net> <sm09pp$86t$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <22d60aea-a441-4a62-a03e-a9c3e050362fn@googlegroups.com>
Subject: Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1
!= "frpc" ]]
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 04 Nov 2021 11:21:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 30
 by: hongy...@gmail.com - Thu, 4 Nov 2021 11:21 UTC

On Thursday, November 4, 2021 at 5:40:14 PM UTC+8, Janis Papanagnou wrote:
> On 04.11.2021 09:13, Josef Moellers wrote:
> > On 04.11.21 06:33, hongy...@gmail.com wrote:
> >> In bash script, both of the following usages are valid:
> >>
> >> [ $1 != "frps" -a $1 != "frpc" ]
> >> [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]
> >>
> >> Which is preferable?
> Depending on the actual requirements (portability anyone?), probably
> none of these.
>
> For the first case; POSIX: ">4 arguments: The results are unspecified."
> (BTW: Why did you quote the constant literals but not the variables?)

Negligence or bad habit of mine :-(
> If you don't care about portability and standards use [[...]] .
>
> Many folks forget that we can formulate (even regexp-)comparisons also
> with the [standard] 'case' construct
>
> case $1 in (frps|frpc) ;; (*) ... ; esac

Which type of regexp is supported here?

> >
> > The one which is most easily understandable.
> ...and which shows the least surprises (generally and in your context).
>
> Janis

Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]

<sm0g7m$ij8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4578&group=comp.unix.shell#4578

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: [ $1 != "frps" -a $1 != "frpc" ] vs [[ $1 != "frps" ]] && [[ $1
!= "frpc" ]]
Date: Thu, 4 Nov 2021 12:29:58 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <sm0g7m$ij8$1@dont-email.me>
References: <66a5b8b1-5864-4d1d-a759-c7a944342c16n@googlegroups.com>
<iuhj0mFrm03U1@mid.individual.net> <sm09pp$86t$1@dont-email.me>
<22d60aea-a441-4a62-a03e-a9c3e050362fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 4 Nov 2021 11:29:58 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="cad4fdccaaf212528dbffc2421b81430";
logging-data="19048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196TfJ+UfWeVeRxV0Q75pcj"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:L2Mxd/SOsxUvprX1x8+IQN1zc+w=
In-Reply-To: <22d60aea-a441-4a62-a03e-a9c3e050362fn@googlegroups.com>
 by: Janis Papanagnou - Thu, 4 Nov 2021 11:29 UTC

On 04.11.2021 12:21, hongy...@gmail.com wrote:
> On Thursday, November 4, 2021 at 5:40:14 PM UTC+8, Janis Papanagnou wrote:
>> On 04.11.2021 09:13, Josef Moellers wrote:
>>> On 04.11.21 06:33, hongy...@gmail.com wrote:
>>>> In bash script, both of the following usages are valid:
>>>>
>>>> [ $1 != "frps" -a $1 != "frpc" ]
>>>> [[ $1 != "frps" ]] && [[ $1 != "frpc" ]]
>>>>
>>>> Which is preferable?
>> Depending on the actual requirements (portability anyone?), probably
>> none of these.
>>
>> For the first case; POSIX: ">4 arguments: The results are unspecified."
>> (BTW: Why did you quote the constant literals but not the variables?)
>
> Negligence or bad habit of mine :-(
>
>> If you don't care about portability and standards use [[...]] .
>>
>> Many folks forget that we can formulate (even regexp-)comparisons also
>> with the [standard] 'case' construct
>>
>> case $1 in (frps|frpc) ;; (*) ... ; esac
>
> Which type of regexp is supported here?

Sorry, it's techncally not "regexps" (BRE, ERE) but Shell Patterns.
(The same that are also supported in the non-standard 'if [[ ... ]]'
on the right hand side of the comparison operator.)

Janis

>
>>>
>>> The one which is most easily understandable.
>> ...and which shows the least surprises (generally and in your context).
>>
>> Janis

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor