Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

We can defeat gravity. The problem is the paperwork involved.


devel / comp.unix.shell / How do I escape a string that contains both single and double quotes?

SubjectAuthor
* How do I escape a string that contains both single and double quotes?Ottavio Caruso
+- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
+- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
+* Re: How do I escape a string that contains both single and doubleEd Morton
|+- Re: How do I escape a string that contains both single and doubleEd Morton
|+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||+* Re: How do I escape a string that contains both single and doubleEd Morton
|||`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| `* Re: How do I escape a string that contains both single and doubleEd Morton
|||  `* "od" not a mandatory part of the POSIX standard? (was: How do I escape a string Helmut Waitzmann
|||   `- Re: "od" not a mandatory part of the POSIX standard? (was: How do IEd Morton
||+* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
|||`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| +* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
||| |+- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| |`- Re: How do I escape a string that contains both single and double quotes?Keith Thompson
||| +* Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| |+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
||| ||`- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| |`* Re: How do I escape a string that contains both single and doubleWayne
||| | `- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
||| `- Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
||`- Re: How do I escape a string that contains both single and doubleChristian Weisgerber
|`* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| +* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |+* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| ||`- Re: How do I escape a string that contains both single and double quotes?Andreas Eder
| |`* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| | +* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
| | |`- Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| | `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |  `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |   `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |    `* Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| |     `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |      `* Re: How do I escape a string that contains both single and double quotes?Ben Bacarisse
| |       `- Re: How do I escape a string that contains both single and doubleDavid W. Hodgins
| `- Re: How do I escape a string that contains both single and doubleEd Morton
`* Re: How do I escape a string that contains both single and doubleJorgen Grahn
 +* Re: How do I escape a string that contains both single and doubleJanis Papanagnou
 |`* Re: How do I escape a string that contains both single and double quotes?Helmut Waitzmann
 | `- Re: How do I escape a string that contains both single and doubleJanis Papanagnou
 `* Re: How do I escape a string that contains both single and doubleOttavio Caruso
  `* Re: How do I escape a string that contains both single and doubleJorgen Grahn
   `- Re: How do I escape a string that contains both single and doubleOttavio Caruso

Pages:12
How do I escape a string that contains both single and double quotes?

<t0v1pl$b1d$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ottavio2...@yahoo.com (Ottavio Caruso)
Newsgroups: comp.unix.shell
Subject: How do I escape a string that contains both single and double quotes?
Date: Thu, 17 Mar 2022 10:16:21 +0000
Organization: A noiseless patient Spider
Lines: 108
Message-ID: <t0v1pl$b1d$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 10:16:21 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="55c3e5eb760c9e1d186dd6fc2d04eac3";
logging-data="11309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d4taQS+DvQoDdyJBMielWA7AdLP5KRdY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.0.3
Cancel-Lock: sha1:mf/jT54geS6pZqJScIzDulgafCI=
X-No-Archive: yes
Content-Language: en-GB
 by: Ottavio Caruso - Thu, 17 Mar 2022 10:16 UTC

Hi,

I have a function that checks the occurrence of characters in a string:

cw-sort ()
{ echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
}

This is all fine and dandy as long as there are no funny characters:

$ cw-sort uyrwqoequwyroqiuwey8378429537uriewr
4 w
4 u
4 r
3 y
3 q
3 e
2 o
2 i
2 8
2 7
2 3
1 9
1 5
1 4
1 2
1

When you throw single quotes in the mix, you have to escape them in
double quotes:

$ cw-sort "uyrwqoequwyroqiuwey83'''''78429537uriewr"
5 '
4 w
4 u
4 r
3 y
3 q
3 e
2 o
2 i
2 8
2 7
2 3
1 9
1 5
1 4
1 2
1

Likewise, if you throw double quotes in the mix, you have to escape them
in single quotes:

$ cw-sort 'uyrwqoequwyroqiuwey83"""""""""""78429537uriewr'
11 "
4 w
4 u
4 r
3 y
3 q
3 e
2 o
2 i
2 8
2 7
2 3
1 9
1 5
1 4
1 2
1

But what if you have both single and double quotes?

$ cw-sort 'uyrwqoequwyroqiuwey83""""'''''78429537uriewr'
>
$ $ cw-sort "uyrwqoequwyroqiuwey83""""'''''78429537uriewr"
5 '
4 w
4 u
4 r
3 y
3 q
3 e
2 o
2 i
2 8
2 7
2 3
1 9
1 5
1 4
1 2
1

Wrapping the string in single quotes, makes the function choke. Wrapping
the string in double quotes makes the double quotes disappear from the
count.

How do I get out of this?

--
Ottavio Caruso

Re: How do I escape a string that contains both single and double quotes?

<t0v38g$ok6$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 11:41:20 +0100
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <t0v38g$ok6$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 10:41:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="afe76413456e8e673dbe3de389586797";
logging-data="25222"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18b5j3UWyFv58f9pUXthP0k"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Vgs7kaDFf8xEODyoxd6pF7Oba7E=
In-Reply-To: <t0v1pl$b1d$1@dont-email.me>
 by: Janis Papanagnou - Thu, 17 Mar 2022 10:41 UTC

On 17.03.2022 11:16, Ottavio Caruso wrote:
> I have a function that checks the occurrence of characters in a string:
>
> cw-sort ()
> {
> echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
> }
>
>
> This is all fine and dandy as long as there are no funny characters:
>
> $ cw-sort uyrwqoequwyroqiuwey8378429537uriewr
> [...]
> When you throw single quotes in the mix, you have to escape them in
> double quotes:
>
> $ cw-sort "uyrwqoequwyroqiuwey83'''''78429537uriewr"
> [...]
> Likewise, if you throw double quotes in the mix, you have to escape them
> in single quotes:
>
> $ cw-sort 'uyrwqoequwyroqiuwey83"""""""""""78429537uriewr'
> [...]
>
> But what if you have both single and double quotes?
>
> $ cw-sort 'uyrwqoequwyroqiuwey83""""'''''78429537uriewr'
>>
> $
> $ cw-sort "uyrwqoequwyroqiuwey83""""'''''78429537uriewr"
> [...]
> Wrapping the string in single quotes, makes the function choke. Wrapping
> the string in double quotes makes the double quotes disappear from the
> count.
>
> How do I get out of this?

$ echo '"double"'and"'single'"
"double"and'single'

(likewise the word /and/ can be put inside the double or single quoted
substrings).

Got the trick (or is an explanation necessary)?

Janis

Re: How do I escape a string that contains both single and double quotes?

<slrnt36c6f.14kq.naddy@lorvorc.mips.inka.de>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 12:59:59 -0000 (UTC)
Message-ID: <slrnt36c6f.14kq.naddy@lorvorc.mips.inka.de>
References: <t0v1pl$b1d$1@dont-email.me>
Injection-Date: Thu, 17 Mar 2022 12:59:59 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="37531"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Thu, 17 Mar 2022 12:59 UTC

On 2022-03-17, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:

> How do I escape a string that contains both single and double quotes?

You can put part of the string in single quotes, part in double
quotes...

"aaaa"'bbbb'

.... and now with the respective other quote character inserted:

"aa'aa"'bb"bb'

Or you can use the backslash to escape individual quotes inside
double quotes:

"aa\"bb"

Or you can close the single quotes, escape an individual single
quote with a backslash, and open the single quotes again:

'aa'\''bb'

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: How do I escape a string that contains both single and double quotes?

<t0vf8p$pv8$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 09:06:16 -0500
Organization: A noiseless patient Spider
Lines: 101
Message-ID: <t0vf8p$pv8$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 14:06:17 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4090d0969088535d1b87dd477f17ee29";
logging-data="26600"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/J1e5Lk/VdqmIcRQ+6h/3A"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:NsT2WWCEpId3i1S+Z4CGI6jxRRY=
In-Reply-To: <t0v1pl$b1d$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220317-0, 3/16/2022), Outbound message
 by: Ed Morton - Thu, 17 Mar 2022 14:06 UTC

On 3/17/2022 5:16 AM, Ottavio Caruso wrote:
> Hi,
>
>
> I have a function that checks the occurrence of characters in a string:
>
> cw-sort ()
> {
> echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
> }

Always quote your variables (see https://mywiki.wooledge.org/Quotes)
unless you have a specific need to not do so, which you don't, (try
without quotes if your input string was `*` or otherwise matched files
in your directory) and use printf instead of echo for robustness and
portability . Also the above echo+sed will add a presumably undesirable
newline to the list of chars seen by sort (note the standalone `1` at
the end of your posted output) so for portability and robustness the
above should really be:

cw-sort () {
printf '%s\n' "$1" | grep -o. | sort | uniq -ic | sort -rn
}

If your grep version doesn't have a `-o` option then you could instead
use either of:

printf ... | fold -w1 | sort ...
printf ... | awk '{for (i=1;i<=length();i++) print substr($0,i,1)}'
| sort

AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
available on your system.

<snip>
> $ cw-sort "uyrwqoequwyroqiuwey83""""'''''78429537uriewr"
> 5 '
> 4 w
> 4 u
> 4 r
> 3 y
> 3 q
> 3 e
> 2 o
> 2 i
> 2 8
> 2 7
> 2 3
> 1 9
> 1 5
> 1 4
> 1 2
> 1
>
> Wrapping the string in single quotes, makes the function choke. Wrapping
> the string in double quotes makes the double quotes disappear from the
> count.
>
> How do I get out of this?
>

In your mind split:

uyrwqoequwyroqiuwey83""""'''''78429537uriewr

into segments with each type of quote:

uyrwqoequwyroqiuwey83"""" ''''' 78429537uriewr

then quote those segments as you usually do:

'uyrwqoequwyroqiuwey83""""' "'''''" '78429537uriewr'

then glue them back together to get:

'uyrwqoequwyroqiuwey83""""'"'''''"'78429537uriewr'

e.g.:

$ cw-sort 'uyrwqoequwyroqiuwey83""""'"'''''"'78429537uriewr'
5 '
4 w
4 u
4 r
4 "
3 y
3 q
3 e
2 o
2 i
2 8
2 7
2 3
1 9
1 5
1 4
1 2

Regards,

Ed.

Re: How do I escape a string that contains both single and double quotes?

<t0vfu2$ufq$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 09:17:39 -0500
Organization: A noiseless patient Spider
Lines: 110
Message-ID: <t0vfu2$ufq$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 17 Mar 2022 14:17:38 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4090d0969088535d1b87dd477f17ee29";
logging-data="31226"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19W7B5RYb0tVJUlSMSwEUtF"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:P+aw1QGal7zhGMnUmx4/KoXvxHc=
In-Reply-To: <t0vf8p$pv8$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220317-0, 3/16/2022), Outbound message
 by: Ed Morton - Thu, 17 Mar 2022 14:17 UTC

On 3/17/2022 9:06 AM, Ed Morton wrote:
> On 3/17/2022 5:16 AM, Ottavio Caruso wrote:
> > Hi,
> >
> >
> > I have a function that checks the occurrence of characters in a string:
> >
> > cw-sort ()
> > {
> >      echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
> > }
>
> Always quote your variables (see https://mywiki.wooledge.org/Quotes)
> unless you have a specific need to not do so, which you don't, (try
> without quotes if your input string was `*` or otherwise matched files
> in your directory) and use printf instead of echo for robustness and
> portability . Also the above echo+sed will add a presumably undesirable
> newline to the list of chars seen by sort (note the standalone `1` at
> the end of your posted output) so for portability and robustness the
> above should really be:
>
>     cw-sort () {
>         printf '%s\n' "$1" | grep -o. | sort | uniq -ic | sort -rn
>     }
>
> If your grep version doesn't have a `-o` option then you could instead
> use either of:
>
>     printf ... | fold -w1 | sort ...
>     printf ... | awk '{for (i=1;i<=length();i++) print substr($0,i,1)}'
> | sort
>
> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
> available on your system.
>
> <snip>
> > $ cw-sort "uyrwqoequwyroqiuwey83""""'''''78429537uriewr"
> >        5 '
> >        4 w
> >        4 u
> >        4 r
> >        3 y
> >        3 q
> >        3 e
> >        2 o
> >        2 i
> >        2 8
> >        2 7
> >        2 3
> >        1 9
> >        1 5
> >        1 4
> >        1 2
> >        1
> >
> > Wrapping the string in single quotes, makes the function choke. Wrapping
> > the string in double quotes makes the double quotes disappear from the
> > count.
> >
> > How do I get out of this?
> >
>
> In your mind split:
>
>     uyrwqoequwyroqiuwey83""""'''''78429537uriewr
>
> into segments with each type of quote:

To clarify that, I really meant separate the segments with single quotes
from those without since you should always wrap strings in single quotes
unless they NEED double quotes (e.g. if they themselves contain single
quotes) so you end up with the segments with single quotes inside double
quotes, and the rest within single quotes.

>
>     uyrwqoequwyroqiuwey83""""   '''''   78429537uriewr
>
> then quote those segments as you usually do:
>
>     'uyrwqoequwyroqiuwey83""""'   "'''''"   '78429537uriewr'
>
> then glue them back together to get:
>
>     'uyrwqoequwyroqiuwey83""""'"'''''"'78429537uriewr'
>
> e.g.:
>
>     $ cw-sort 'uyrwqoequwyroqiuwey83""""'"'''''"'78429537uriewr'
>           5 '
>           4 w
>           4 u
>           4 r
>           4 "
>           3 y
>           3 q
>           3 e
>           2 o
>           2 i
>           2 8
>           2 7
>           2 3
>           1 9
>           1 5
>           1 4
>           1 2
>
> Regards,
>
>     Ed.

Re: How do I escape a string that contains both single and double quotes?

<t0vg1s$138$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 15:19:40 +0100
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <t0vg1s$138$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 14:19:40 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="cd342ef35edcc014353f7c82c29c5ba3";
logging-data="1128"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19h1eyPC3WHz649WtEv5vMs"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pwbh3iRxwqtsw2z6txZgYL3Mnvo=
In-Reply-To: <t0vf8p$pv8$1@dont-email.me>
 by: Janis Papanagnou - Thu, 17 Mar 2022 14:19 UTC

On 17.03.2022 15:06, Ed Morton wrote:
>
> printf ... | fold -w1 | sort ...
> [...]
>
> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
> available on your system.

The fold command is at least as old as UNIX Release 7, so it would
be surprising if it weren't specified in POSIX (where you can indeed
find it).

Janis

Re: How do I escape a string that contains both single and double quotes?

<t0viam$jef$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 09:58:31 -0500
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <t0viam$jef$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 14:58:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4090d0969088535d1b87dd477f17ee29";
logging-data="19919"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EwIl1VYLsIriTLBonpynE"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:inTcQMHRzM+lnVxUckQNMv7p8N8=
In-Reply-To: <t0vg1s$138$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220317-0, 3/16/2022), Outbound message
 by: Ed Morton - Thu, 17 Mar 2022 14:58 UTC

On 3/17/2022 9:19 AM, Janis Papanagnou wrote:
> On 17.03.2022 15:06, Ed Morton wrote:
>>
>> printf ... | fold -w1 | sort ...
>> [...]
>>
>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>> available on your system.
>
> The fold command is at least as old as UNIX Release 7, so it would
> be surprising if it weren't specified in POSIX (where you can indeed
> find it).

It's specified by POSIX, I just don't know if it's *mandatory* by POSIX.

Ed.

Re: How do I escape a string that contains both single and double quotes?

<t0vjqp$1bo$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 16:24:08 +0100
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <t0vjqp$1bo$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <t0viam$jef$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 15:24:09 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="cd342ef35edcc014353f7c82c29c5ba3";
logging-data="1400"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vGSVXv7yUWBn/3k7FI7Jp"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:8Z48EurdwhPJfdS7fhd0le3DAsA=
In-Reply-To: <t0viam$jef$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 17 Mar 2022 15:24 UTC

On 17.03.2022 15:58, Ed Morton wrote:
> On 3/17/2022 9:19 AM, Janis Papanagnou wrote:
>> On 17.03.2022 15:06, Ed Morton wrote:
>>>
>>> printf ... | fold -w1 | sort ...
>>> [...]
>>>
>>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>>> available on your system.
>>
>> The fold command is at least as old as UNIX Release 7, so it would
>> be surprising if it weren't specified in POSIX (where you can indeed
>> find it).
>
> It's specified by POSIX, I just don't know if it's *mandatory* by POSIX.

And where would that distinction be made? (I can't see anything.)
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fold.html

And what would be the rationale for not declaring such a basic tool
as mandatory that is around in the Unix toolbox for more than four
decades?

Janis

Re: How do I escape a string that contains both single and double quotes?

<t0voqq$f99$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 11:49:29 -0500
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <t0voqq$f99$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <t0viam$jef$1@dont-email.me>
<t0vjqp$1bo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 16:49:30 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4090d0969088535d1b87dd477f17ee29";
logging-data="15657"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Yd2qM0Hk99RCIt/sOLsZB"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:Jg0Wo+n1eP+FKjHG//IJ7mqwg8c=
In-Reply-To: <t0vjqp$1bo$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220317-0, 3/16/2022), Outbound message
 by: Ed Morton - Thu, 17 Mar 2022 16:49 UTC

On 3/17/2022 10:24 AM, Janis Papanagnou wrote:
> On 17.03.2022 15:58, Ed Morton wrote:
>> On 3/17/2022 9:19 AM, Janis Papanagnou wrote:
>>> On 17.03.2022 15:06, Ed Morton wrote:
>>>>
>>>> printf ... | fold -w1 | sort ...
>>>> [...]
>>>>
>>>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>>>> available on your system.
>>>
>>> The fold command is at least as old as UNIX Release 7, so it would
>>> be surprising if it weren't specified in POSIX (where you can indeed
>>> find it).
>>
>> It's specified by POSIX, I just don't know if it's *mandatory* by POSIX.
>
> And where would that distinction be made? (I can't see anything.)
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fold.html

The mandatory ones are those not marked as optional in their definition
page. It'd be great if there was just a list of such tools but AFAIK
there isn't.

> And what would be the rationale for not declaring such a basic tool
> as mandatory that is around in the Unix toolbox for more than four
> decades?

You'd have to ask the guys who write the specs but "od" is one example
of a basic tool that's been around for decades and apparently isn't
mandatory since it's annotated with "XSI" in the spec -
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html.
Similarly for cal, ex, talk, who, yacc, etc. - they have various
annotations and so are not mandatory.

You inspired me to look and I see no annotation for "fold" at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fold.html so
it must be mandatory.

Ed

Re: How do I escape a string that contains both single and double quotes?

<87wngszdpm.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Thu, 17 Mar 2022 17:33:09 +0000
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <87wngszdpm.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="8179eac41ad0d4ebbe49b8fa97db0394";
logging-data="27551"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XeXUiiGTpG442JV+8+B8PEZOTkyFJvXo="
Cancel-Lock: sha1:WDA7wkqWxra+IHRHLG6tJeuzU00=
sha1:wVusfQBnrC+oqtNtT2oZrKR84xs=
X-BSB-Auth: 1.eeb169552cd7eb74f388.20220317173309GMT.87wngszdpm.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 17 Mar 2022 17:33 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

> On 17.03.2022 15:06, Ed Morton wrote:
>>
>> printf ... | fold -w1 | sort ...
>> [...]
>>
>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>> available on your system.
>
> The fold command is at least as old as UNIX Release 7, so it would
> be surprising if it weren't specified in POSIX (where you can indeed
> find it).

Is Release 7 the same as version 7 (i.e. the first widely distributed
version from the late 70s)? If so, I can't find any record of fold being
part of it.

--
Ben.

"od" not a mandatory part of the POSIX standard? (was: How do I escape a string that contains both single and double quotes?)

<83ee3043xq.fsf_-_@helmutwaitzmann.news.arcor.de>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!ryqd0e0KdItPn+dOLmys0g.user.46.165.242.75.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: "od" not a mandatory part of the POSIX standard? (was: How do I escape a string that contains both single and double quotes?)
Date: Thu, 17 Mar 2022 23:20:01 +0100
Organization: Aioe.org NNTP Server
Message-ID: <83ee3043xq.fsf_-_@helmutwaitzmann.news.arcor.de>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <t0viam$jef$1@dont-email.me>
<t0vjqp$1bo$1@dont-email.me> <t0voqq$f99$1@dont-email.me>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Info: gioia.aioe.org; logging-data="18317"; posting-host="ryqd0e0KdItPn+dOLmys0g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mail-Copies-To: nobody
Cancel-Lock: sha1:7uh6z2P0FfDEyBnGn+VBRq0sIqc=
 by: Helmut Waitzmann - Thu, 17 Mar 2022 22:20 UTC

Ed Morton <mortonspam@gmail.com>:

> You'd have to ask the guys who write the specs but "od" is one
> example of a basic tool that's been around for decades and
> apparently isn't mandatory since it's annotated with "XSI" in the
> spec -

I don't think so.  The "XSI" tag in the spec

>https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html.

only comprises the old invocation syntax

od [-bcdosx] [file] [[+]offset[.][b]][Option End]

One can use the modern syntax instead:

od [-v] [-A address_base] [-j skip] [-N count] [-t type_string]...
[file...]

which is not affected by the "XSI" tag.  See also the sections labeled
"RATIONALE"
(<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html#tag_20_88_18>)
and "FUTURE DIRECTIONS"
(<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html#tag_20_88_19>).

Re: "od" not a mandatory part of the POSIX standard? (was: How do I escape a string that contains both single and double quotes?)

<t10cou$pg7$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: "od" not a mandatory part of the POSIX standard? (was: How do I
escape a string that contains both single and double quotes?)
Date: Thu, 17 Mar 2022 17:29:50 -0500
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <t10cou$pg7$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <t0viam$jef$1@dont-email.me>
<t0vjqp$1bo$1@dont-email.me> <t0voqq$f99$1@dont-email.me>
<83ee3043xq.fsf_-_@helmutwaitzmann.news.arcor.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 17 Mar 2022 22:29:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4090d0969088535d1b87dd477f17ee29";
logging-data="26119"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18A4dMHYEc5E18Ef043IfbU"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:qNaTCHlwlN79Vtcn8CpjIxXOPSA=
In-Reply-To: <83ee3043xq.fsf_-_@helmutwaitzmann.news.arcor.de>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220317-8, 3/17/2022), Outbound message
 by: Ed Morton - Thu, 17 Mar 2022 22:29 UTC

On 3/17/2022 5:20 PM, Helmut Waitzmann wrote:
> Ed Morton <mortonspam@gmail.com>:
>
>> You'd have to ask the guys who write the specs but "od" is one example
>> of a basic tool that's been around for decades and apparently isn't
>> mandatory since it's annotated with "XSI" in the spec -
>
>
> I don't think so.  The "XSI" tag in the spec
>
>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html.
>
>
> only comprises the old invocation syntax
>
>  od [-bcdosx] [file] [[+]offset[.][b]][Option End]
>
>
> One can use the modern syntax instead:
>
>  od [-v] [-A address_base] [-j skip] [-N count] [-t type_string]...
>         [file...]
>
> which is not affected by the "XSI" tag.  See also the sections labeled
> "RATIONALE"
> (<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html#tag_20_88_18>)
> and "FUTURE DIRECTIONS"
> (<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html#tag_20_88_19>).
>

OK, bad choice I guess, I didn't want to spend much time on this so just
glanced at the first one that came to mind. Look at `cal`
(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cal.html) or
`ex`
(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html) or
one of the others I mentioned or just poke around other commands instead
then and you'll see some examples.

Ed.

Re: How do I escape a string that contains both single and double quotes?

<slrnt37cdc.1fmo.naddy@lorvorc.mips.inka.de>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.niel.me!aioe.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 22:09:48 -0000 (UTC)
Message-ID: <slrnt37cdc.1fmo.naddy@lorvorc.mips.inka.de>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me>
Injection-Date: Thu, 17 Mar 2022 22:09:48 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="48857"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Thu, 17 Mar 2022 22:09 UTC

On 2022-03-17, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

> The fold command is at least as old as UNIX Release 7, so it would
> be surprising if it weren't specified in POSIX (where you can indeed
> find it).

fold(1) seems to be from BSD. Bill Joy wrote it on June 28, 1977.
(Says the first version checked into the CSRG repository in 1980.)

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: How do I escape a string that contains both single and double quotes?

<t10g7l$k43$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 00:28:52 +0100
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <t10g7l$k43$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Mar 2022 23:28:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f1aa0ff20907ebe22a9eba7bb989115b";
logging-data="20611"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19niZZMgxYOsmf/dqckAs76"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:8KKmBHIaCHlrPjxjQD9jf9Qn+Ow=
In-Reply-To: <87wngszdpm.fsf@bsb.me.uk>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 17 Mar 2022 23:28 UTC

On 17.03.2022 18:33, Ben Bacarisse wrote:
> Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
>
>> On 17.03.2022 15:06, Ed Morton wrote:
>>>
>>> printf ... | fold -w1 | sort ...
>>> [...]
>>>
>>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>>> available on your system.
>>
>> The fold command is at least as old as UNIX Release 7, so it would
>> be surprising if it weren't specified in POSIX (where you can indeed
>> find it).
>
> Is Release 7 the same as version 7 (i.e. the first widely distributed
> version from the late 70s)? If so, I can't find any record of fold being
> part of it.

Yes, I meant Version 7. The source I looked at is my first (German)
book about Unix; it is based on Version 7 and was published 1984.
There the fold command syntax is defined as fold [-width] {files}

Janis

Re: How do I escape a string that contains both single and double quotes?

<op.1i68yep8a3w0dxdave@hodgins.homeip.net>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Thu, 17 Mar 2022 20:00:04 -0400
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <op.1i68yep8a3w0dxdave@hodgins.homeip.net>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="721bb866abc607e1ebef242ad357248e";
logging-data="989"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yiEMRl4yHaoyaeLW4pYwLp5vJ+7WgZ5c="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:yS7EIm83TJIPXbxdxynCamFG/OM=
 by: David W. Hodgins - Fri, 18 Mar 2022 00:00 UTC

On Thu, 17 Mar 2022 19:28:52 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> Yes, I meant Version 7. The source I looked at is my first (German)
> book about Unix; it is based on Version 7 and was published 1984.
> There the fold command syntax is defined as fold [-width] {files}

https://www.gnu.org/software/coreutils/manual/coreutils.html#fold-invocation

The -width option is considered obsolete.

Regards, Dave Hodgins

Re: How do I escape a string that contains both single and double quotes?

<t10imu$45f$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 01:11:10 +0100
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <t10imu$45f$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me> <op.1i68yep8a3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 18 Mar 2022 00:11:11 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f1aa0ff20907ebe22a9eba7bb989115b";
logging-data="4271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bXNcaG6/u8MpdjBbB5NDz"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:HvADKusjseY3fnObFTlH1xkmQ5E=
In-Reply-To: <op.1i68yep8a3w0dxdave@hodgins.homeip.net>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 18 Mar 2022 00:11 UTC

On 18.03.2022 01:00, David W. Hodgins wrote:
> On Thu, 17 Mar 2022 19:28:52 -0400, Janis Papanagnou
> <janis_papanagnou@hotmail.com> wrote:
>> Yes, I meant Version 7. The source I looked at is my first (German)
>> book about Unix; it is based on Version 7 and was published 1984.
>> There the fold command syntax is defined as fold [-width] {files}
>
> https://www.gnu.org/software/coreutils/manual/coreutils.html#fold-invocation
>
>
> The -width option is considered obsolete.

I am aware of that. I mentioned the old syntax to show that (while
fold was existing in Version 7) there's a difference in how it can
be used; the "old" 'fold' did also not support -s, and -b (that is
certainly necessary nowadays to distinguish bytes from characters).

Janis

Re: How do I escape a string that contains both single and double quotes?

<871qyz4wx0.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Thu, 17 Mar 2022 23:06:19 -0700
Organization: None to speak of
Lines: 27
Message-ID: <871qyz4wx0.fsf@nosuchdomain.example.com>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me>
<op.1i68yep8a3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ab020ad81f6ee0d5641632ba39e2cf2c";
logging-data="27287"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sgZR0AzY089/5jP2Db/6U"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:6/iZffuXOnd4sc2f6XWt9807Q9Q=
sha1:lBbi3Ln7weWow/QB9YSpoHE94p8=
 by: Keith Thompson - Fri, 18 Mar 2022 06:06 UTC

"David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:
> On Thu, 17 Mar 2022 19:28:52 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>> Yes, I meant Version 7. The source I looked at is my first (German)
>> book about Unix; it is based on Version 7 and was published 1984.
>> There the fold command syntax is defined as fold [-width] {files}
>
> https://www.gnu.org/software/coreutils/manual/coreutils.html#fold-invocation
>
> The -width option is considered obsolete.

Just in case it isn't clear, the obsolete "-width" option means, for
example:
fold -72

The coreutils version continues to support that, but recommends
fold -w 72
or
fold --width=72

POSIX specifies "fold -w 72" and doesn't mention the "fold -72" form.

(For arbitrary values of 72, of course.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: How do I escape a string that contains both single and double quotes?

<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>

  copy mid

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

  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: grahn+n...@snipabacken.se (Jorgen Grahn)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: 18 Mar 2022 08:28:18 GMT
Lines: 32
Message-ID: <slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
References: <t0v1pl$b1d$1@dont-email.me>
X-Trace: individual.net P8eLKEOA3nGsnso2UVNTcAJiK8/+JJxoUXGFpw+wsLhcKu6TKr
Cancel-Lock: sha1:Y/eDRgnyNiL8CmDqnTGAdWGk7bw=
User-Agent: slrn/1.0.3 (OpenBSD)
 by: Jorgen Grahn - Fri, 18 Mar 2022 08:28 UTC

On Thu, 2022-03-17, Ottavio Caruso wrote:
> Hi,
>
>
> I have a function that checks the occurrence of characters in a string:
>
> cw-sort ()
> {
> echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
> }

(Nitpick: the name of the function and the description don't fit. The
sorting seems incidental rather than essential.)

> This is all fine and dandy as long as there are no funny characters:
>
> $ cw-sort uyrwqoequwyroqiuwey8378429537uriewr

I think your problem stems from putting data in variables instead of
in pipes/streams. The very first thing your function does is (via
echo) transforming the input back to a stream, so the function itself
doesn't require that.

If your cw-sort function read from stdin instead, could you still fit
it into your workflow? I'm assuming you're normally calling it from
some larger script.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Re: How do I escape a string that contains both single and double quotes?

<t11hvu$8pc$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 10:05:01 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <t11hvu$8pc$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 18 Mar 2022 09:05:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f1aa0ff20907ebe22a9eba7bb989115b";
logging-data="9004"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nBUCLhLjuwWAGuqd2d1ZN"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:IMEkaKi0VIrQ+Qgvk1Mb5LuTgPE=
In-Reply-To: <slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 18 Mar 2022 09:05 UTC

On 18.03.2022 09:28, Jorgen Grahn wrote:
> On Thu, 2022-03-17, Ottavio Caruso wrote:
>> Hi,
>>
>>
>> I have a function that checks the occurrence of characters in a string:
>>
>> cw-sort ()
>> {
>> echo $1 | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
>> }
>
> (Nitpick: the name of the function and the description don't fit. The
> sorting seems incidental rather than essential.)
>
>> This is all fine and dandy as long as there are no funny characters:
>>
>> $ cw-sort uyrwqoequwyroqiuwey8378429537uriewr
>
> I think your problem stems from putting data in variables instead of
> in pipes/streams.

I don't think so. Whether the stream or variable, at that point where
the value is assigned it needs proper quoting. Here is a function that
accepts both methods, and input measures and the results are the same.

cw_sort ()
{
if (($#))
then printf "%s" "$1"
else cat -
fi | sed 's/./&\n/g' | sort | uniq -ic | sort -rn
}

echo ===
cw_sort "gsd'u'z'dfed"'gw"ef"d"ev"djnfr'
echo ===
printf "%s" "gsd'u'z'dfed"'gw"ef"d"ev"djnfr' | cw_sort
echo ===

Notes: For simplicity I used non-standard ((...)). And I changed the
'-' in the function name to '_' to be more portable.

Janis

> The very first thing your function does is (via
> echo) transforming the input back to a stream, so the function itself
> doesn't require that.
>
> If your cw-sort function read from stdin instead, could you still fit
> it into your workflow? I'm assuming you're normally calling it from
> some larger script.
>
> /Jorgen
>

Re: How do I escape a string that contains both single and double quotes?

<t11qkq$2go$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ottavio2...@yahoo.com (Ottavio Caruso)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 11:32:42 +0000
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <t11qkq$2go$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 18 Mar 2022 11:32:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="48027d78ab1c47cb1a6936c21bd16cd3";
logging-data="2584"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ESEvizHfwvpFzfhHzUjcOQ1nuvWQJJcw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.0.3
Cancel-Lock: sha1:q6QtRRmrTqKyRLxvAnUpydobjxA=
X-No-Archive: yes
In-Reply-To: <slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
Content-Language: en-GB
 by: Ottavio Caruso - Fri, 18 Mar 2022 11:32 UTC

On 18/03/2022 08:28, Jorgen Grahn wrote:
> If your cw-sort function read from stdin instead, could you still fit
> it into your workflow? I'm assuming you're normally calling it from
> some larger script.

No, I call it from the shell.

This is supposed to check the frequency of mistakes I make while
learning Morse code on lcwo.net.

--
Ottavio Caruso

Re: How do I escape a string that contains both single and double quotes?

<slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 15:51:01 -0000 (UTC)
Message-ID: <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me>
Injection-Date: Fri, 18 Mar 2022 15:51:01 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="69565"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Fri, 18 Mar 2022 15:51 UTC

On 2022-03-17, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

>> Is Release 7 the same as version 7 (i.e. the first widely distributed
>> version from the late 70s)? If so, I can't find any record of fold being
>> part of it.
>
> Yes, I meant Version 7. The source I looked at is my first (German)
> book about Unix; it is based on Version 7 and was published 1984.
> There the fold command syntax is defined as fold [-width] {files}

I don't think that book is a reliable source in this respect.

You can browse the source tree of UNIX V7 here:
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7

There is no fold(1) command.

fold.c did however ship with 1BSD. (It's in s6/cont.a.)

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: How do I escape a string that contains both single and double quotes?

<t131qh$4rk$1@dont-email.me>

  copy mid

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

  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: How do I escape a string that contains both single and double
quotes?
Date: Fri, 18 Mar 2022 23:41:21 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <t131qh$4rk$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me> <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 18 Mar 2022 22:41:21 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f1aa0ff20907ebe22a9eba7bb989115b";
logging-data="4980"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EGLDsbTH/5moyKOshxGBM"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:wpwpvzBT8E0XYap+3rQj+KEObEA=
In-Reply-To: <slrnt39aj5.23ts.naddy@lorvorc.mips.inka.de>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 18 Mar 2022 22:41 UTC

On 18.03.2022 16:51, Christian Weisgerber wrote:
> On 2022-03-17, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>
>>> Is Release 7 the same as version 7 (i.e. the first widely distributed
>>> version from the late 70s)? If so, I can't find any record of fold being
>>> part of it.
>>
>> Yes, I meant Version 7. The source I looked at is my first (German)
>> book about Unix; it is based on Version 7 and was published 1984.
>> There the fold command syntax is defined as fold [-width] {files}
>
> I don't think that book is a reliable source in this respect.

That may be, I really cannot tell. But reinspecting the introductory
chapter of that book more closely I saw that it says it's based on
UNIX Version 7 and that it also includes the description of a couple
common and wide spread extensions. So that would be in sync with your
observation WRT Version 7. But note that my comment was not so much
focused on which exact version it was but since when the fold command
was known; and since the book was from 1984 fold is now already known
about four decades. But thanks for catching that inaccuracy concerning
the mentioned release!

> You can browse the source tree of UNIX V7 here:
> https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7

It seems there's a lot tools missing at that time (like cut).

>
> There is no fold(1) command.
>
> fold.c did however ship with 1BSD. (It's in s6/cont.a.)

When was that? (Must have been before 1984, I'd have to suppose.)

Janis

Re: How do I escape a string that contains both single and double quotes?

<838rt73rlp.fsf@helmutwaitzmann.news.arcor.de>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!PM47iy0Mveywk/eNYRezVA.user.46.165.242.75.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Fri, 18 Mar 2022 21:58:42 +0100
Organization: Aioe.org NNTP Server
Message-ID: <838rt73rlp.fsf@helmutwaitzmann.news.arcor.de>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid>
<t11hvu$8pc$1@dont-email.me>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Info: gioia.aioe.org; logging-data="27468"; posting-host="PM47iy0Mveywk/eNYRezVA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Copies-To: nobody
Cancel-Lock: sha1:l88NkvlXrmnvuV6joEbZpLT+QPM=
 by: Helmut Waitzmann - Fri, 18 Mar 2022 20:58 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com>:

> if (($#))

[…]

>Notes: For simplicity I used non-standard ((...)).
>

If one wants to do it the standard way one can do

if ${1+:} false

Re: How do I escape a string that contains both single and double quotes?

<87r16yswam.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: How do I escape a string that contains both single and double quotes?
Date: Fri, 18 Mar 2022 22:58:09 +0000
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <87r16yswam.fsf@bsb.me.uk>
References: <t0v1pl$b1d$1@dont-email.me> <t0vf8p$pv8$1@dont-email.me>
<t0vg1s$138$1@dont-email.me> <87wngszdpm.fsf@bsb.me.uk>
<t10g7l$k43$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="83ecc5115f210f8766016cf9056ac8f3";
logging-data="27792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+B9CNXRIabwZibpPX2JXzsZjlKzoiIgF8="
Cancel-Lock: sha1:vPB1Nq2Ud0AVtFE8ulaXe2e21mE=
sha1:WXyKmDBtPUjaY4AIqDMYfzvIVpk=
X-BSB-Auth: 1.25e7f8dd2e71239746c3.20220318225809GMT.87r16yswam.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 18 Mar 2022 22:58 UTC

Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

> On 17.03.2022 18:33, Ben Bacarisse wrote:
>> Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
>>
>>> On 17.03.2022 15:06, Ed Morton wrote:
>>>>
>>>> printf ... | fold -w1 | sort ...
>>>> [...]
>>>>
>>>> AFAIK fold isn't a mandatory POSIX tool but awk is and so WILL be
>>>> available on your system.
>>>
>>> The fold command is at least as old as UNIX Release 7, so it would
>>> be surprising if it weren't specified in POSIX (where you can indeed
>>> find it).
>>
>> Is Release 7 the same as version 7 (i.e. the first widely distributed
>> version from the late 70s)? If so, I can't find any record of fold being
>> part of it.
>
> Yes, I meant Version 7. The source I looked at is my first (German)
> book about Unix; it is based on Version 7 and was published 1984.
> There the fold command syntax is defined as fold [-width] {files}

There's no direct evidence: a VM of V7 Unix I have has no fold command,
the online archives of V7 have no fold command, and (least reliable of
all) I don't remember a fold command in V7!

(It's just an academic point -- it's in POSIX and can be relied on.)

--
Ben.

Re: How do I escape a string that contains both single and double quotes?

<t13465$om9$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.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: How do I escape a string that contains both single and double
quotes?
Date: Sat, 19 Mar 2022 00:21:41 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <t13465$om9$1@dont-email.me>
References: <t0v1pl$b1d$1@dont-email.me>
<slrnt38gl2.1rfm.grahn+nntp@frailea.sa.invalid> <t11hvu$8pc$1@dont-email.me>
<838rt73rlp.fsf@helmutwaitzmann.news.arcor.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 18 Mar 2022 23:21:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c1006e0bf8b5797bc1c73f5a3d9e9b39";
logging-data="25289"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eCHTQwWXzZrFs5ZI71HeE"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:R/ZwzUst+iI8E+RhE5J9pLT+U2Q=
In-Reply-To: <838rt73rlp.fsf@helmutwaitzmann.news.arcor.de>
 by: Janis Papanagnou - Fri, 18 Mar 2022 23:21 UTC

On 18.03.2022 21:58, Helmut Waitzmann wrote:
> Janis Papanagnou <janis_papanagnou@hotmail.com>:
>
>> if (($#))
>
> […]
>
>> Notes: For simplicity I used non-standard ((...)).
>
> If one wants to do it the standard way one can do
>
> if ${1+:} false

An interesting construct.

I'd have more thought of the conventional (and likely
easier to understand) if [ $# -gt 0 ]

Janis

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor