Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Why won't sharks eat lawyers? Professional courtesy.


devel / comp.unix.shell / correct escaping or etc for `--head--'

SubjectAuthor
* correct escaping or etc for `--head--'hput
+* Re: correct escaping or etc for `--head--'Janis Papanagnou
|`- Re: correct escaping or etc for `--head--'Lew Pitcher
+- Re: correct escaping or etc for `--head--'David W. Hodgins
+- Re: correct escaping or etc for `--head--'Keith Thompson
`- Re: correct escaping or etc for `--head--'Helmut Waitzmann

1
correct escaping or etc for `--head--'

<87tuau2dqq.fsf@local.lan>

 copy mid

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

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx42.iad.POSTED!not-for-mail
From: hpu...@zohomail.com (hput)
Newsgroups: comp.unix.shell
Subject: correct escaping or etc for `--head--'
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Message-ID: <87tuau2dqq.fsf@local.lan>
Cancel-Lock: sha1:fiyLvu9OnLfivl1v8cCVh1ByJF4=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 37
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 15 Apr 2022 18:17:17 -0400
X-Received-Bytes: 1724
 by: hput - Fri, 15 Apr 2022 22:17 UTC

Running: Ubuntu 20.04 linux with bash

Some how I've managed to get a directory written with the name
`--head--'. Haven't been able to figure out how this got written.

It appears amongst a short list of other directories that are the
names of zfs snapshots.

The `--head--' critter is a directory with files and subdiretories in it. Or at
least that is how emacs sees it.

I want to see it with a simple `ls' or `ls -l' command. A few of what
I've tried:

are:
ls

'--head--'

\-\-head\-\-

[\-][\-]head[\-][\-]

That has drained my obviously less than skillful guesses.

showing the naming mistake in place:

cd /rhosts/.zfs/snapshot
ls -l
drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_daily
drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_monthly
drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_weekly
drwxrwxrwx 1 root root 0 Apr 15 17:34 --head--

Can anyone offer something that actually works?

Re: correct escaping or etc for `--head--'

<t3crel$ej7$1@dont-email.me>

 copy mid

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

 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: correct escaping or etc for `--head--'
Date: Sat, 16 Apr 2022 00:26:28 +0200
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <t3crel$ej7$1@dont-email.me>
References: <87tuau2dqq.fsf@local.lan>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Apr 2022 22:26:29 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4648f8bd43a32a3889f1476915af1847";
logging-data="14951"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191xdJ3IRWT5p3fsKY3uIO8"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:j3wIxMFxgiCqppa3SSf9YkGdK3o=
In-Reply-To: <87tuau2dqq.fsf@local.lan>
 by: Janis Papanagnou - Fri, 15 Apr 2022 22:26 UTC

On 16.04.2022 00:17, hput wrote:
> Running: Ubuntu 20.04 linux with bash
>
> Some how I've managed to get a directory written with the name
> `--head--'. Haven't been able to figure out how this got written.
>
> It appears amongst a short list of other directories that are the
> names of zfs snapshots.
>
> The `--head--' critter is a directory with files and subdiretories in it. Or at
> least that is how emacs sees it.
>
> I want to see it with a simple `ls' or `ls -l' command. A few of what
> I've tried:
>
> are:
> ls
>
> '--head--'
>
> \-\-head\-\-
>
> [\-][\-]head[\-][\-]
>
> That has drained my obviously less than skillful guesses.
>
>
> showing the naming mistake in place:
>
> cd /rhosts/.zfs/snapshot
> ls -l
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_daily
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_monthly
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_weekly
> drwxrwxrwx 1 root root 0 Apr 15 17:34 --head--
>
>
> Can anyone offer something that actually works?
>

It's nothing to do with escaping. The tools called with such arguments
considers it an option. To prevent that use the end-of-option marker as
in

ls -- --head--
rmdir -- --head--

etc.

Janis

Re: correct escaping or etc for `--head--'

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

 copy mid

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

 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: correct escaping or etc for `--head--'
Date: Fri, 15 Apr 2022 18:29:54 -0400
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <op.1kot34qya3w0dxdave@hodgins.homeip.net>
References: <87tuau2dqq.fsf@local.lan>
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="026b6ac460f70ad92da1cb3c551e0f3d";
logging-data="16143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wjB84aaRGMF/k6xY29JbTV8XoQiYkaC4="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:Dv1D6wryulJIv1DXVeIq3yF4MZY=
 by: David W. Hodgins - Fri, 15 Apr 2022 22:29 UTC

On Fri, 15 Apr 2022 18:17:17 -0400, hput <hputn3@zohomail.com> wrote:
> I want to see it with a simple `ls' or `ls -l' command. A few of what
> I've tried:

$ tree -ifa
..
../--head--
../--head--/somefile
1 directory, 1 file

$ ls -l -- --head--
total 0
-rw-r--r-- 1 dave dave 0 Apr 15 18:24 somefile

I created the directory and file with ...
$ mkdir -- --head--
$ touch -- --head--/somefile

The "-- " indicates what follows is not to be parsed as an option.

Regards, Dave Hodgins

Re: correct escaping or etc for `--head--'

<t3csbj$qaq$1@dont-email.me>

 copy mid

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

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.shell
Subject: Re: correct escaping or etc for `--head--'
Date: Fri, 15 Apr 2022 22:41:55 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <t3csbj$qaq$1@dont-email.me>
References: <87tuau2dqq.fsf@local.lan> <t3crel$ej7$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Apr 2022 22:41:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8f260af91e7b00dbf5311aef507c97b4";
logging-data="26970"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NkBz/qB9bLsnFW213ClQ7WCfVuHMSmt4="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:UkGbIDmzSQM5vNuVnN9N0WLihi8=
 by: Lew Pitcher - Fri, 15 Apr 2022 22:41 UTC

On Sat, 16 Apr 2022 00:26:28 +0200, Janis Papanagnou wrote:

> On 16.04.2022 00:17, hput wrote:
>> Running: Ubuntu 20.04 linux with bash
>>
>> Some how I've managed to get a directory written with the name
>> `--head--'. Haven't been able to figure out how this got written.
>>
>> It appears amongst a short list of other directories that are the
>> names of zfs snapshots.
>>
>> The `--head--' critter is a directory with files and subdiretories in it. Or at
>> least that is how emacs sees it.
>>
>> I want to see it with a simple `ls' or `ls -l' command. A few of what
>> I've tried:
>>
>> are:
>> ls
>>
>> '--head--'
>>
>> \-\-head\-\-
>>
>> [\-][\-]head[\-][\-]
>>
>> That has drained my obviously less than skillful guesses.
>>
>>
>> showing the naming mistake in place:
>>
>> cd /rhosts/.zfs/snapshot
>> ls -l
>> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_daily
>> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_monthly
>> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_weekly
>> drwxrwxrwx 1 root root 0 Apr 15 17:34 --head--
>>
>>
>> Can anyone offer something that actually works?
>>
>
> It's nothing to do with escaping. The tools called with such arguments
> considers it an option. To prevent that use the end-of-option marker as
> in
>
> ls -- --head--
> rmdir -- --head--

alternately...
ls ./--head--
rmdir ./--head--

--
Lew Pitcher
"In Skills, We Trust"

Re: correct escaping or etc for `--head--'

<87ilradl4v.fsf@nosuchdomain.example.com>

 copy mid

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

 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: correct escaping or etc for `--head--'
Date: Fri, 15 Apr 2022 15:42:08 -0700
Organization: None to speak of
Lines: 47
Message-ID: <87ilradl4v.fsf@nosuchdomain.example.com>
References: <87tuau2dqq.fsf@local.lan>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="3725248eb51eaf4c8ed29483282c97d4";
logging-data="20210"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KPG35v2Vtyv6drduVQ6dW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:7Pw16RiRZ0peuis5/IKWnu4Zg9A=
sha1:B6pQ/owRrz/G+nmbt2WtRG/akqM=
 by: Keith Thompson - Fri, 15 Apr 2022 22:42 UTC

hput <hputn3@zohomail.com> writes:
> Running: Ubuntu 20.04 linux with bash
>
> Some how I've managed to get a directory written with the name
> `--head--'. Haven't been able to figure out how this got written.
>
> It appears amongst a short list of other directories that are the
> names of zfs snapshots.
>
> The `--head--' critter is a directory with files and subdiretories in it. Or at
> least that is how emacs sees it.
>
> I want to see it with a simple `ls' or `ls -l' command. A few of what
> I've tried:
>
> are:
> ls
>
> '--head--'
>
> \-\-head\-\-
>
> [\-][\-]head[\-][\-]
>
> That has drained my obviously less than skillful guesses.
>
>
> showing the naming mistake in place:
>
> cd /rhosts/.zfs/snapshot
> ls -l
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_daily
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_monthly
> drwxrwxrwx 1 root root 0 Apr 15 17:34 autosnap_2022-04-14_15:55:20_weekly
> drwxrwxrwx 1 root root 0 Apr 15 17:34 --head--
>
>
> Can anyone offer something that actually works?

Others have suggested "ls -- --head--".

Another option is "ls ./--head--".

--
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: correct escaping or etc for `--head--'

<83tuatmxwr.fsf@helmutwaitzmann.news.arcor.de>

 copy mid

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

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!AbVCr/cGH2V/EWFyS0Ho/g.user.46.165.242.75.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: correct escaping or etc for `--head--'
Date: Sat, 16 Apr 2022 06:53:40 +0200
Organization: Aioe.org NNTP Server
Message-ID: <83tuatmxwr.fsf@helmutwaitzmann.news.arcor.de>
References: <87tuau2dqq.fsf@local.lan>
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="11116"; posting-host="AbVCr/cGH2V/EWFyS0Ho/g.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:PHAilUoKXmsGQxAjbO8Tj1wgDKI=
 by: Helmut Waitzmann - Sat, 16 Apr 2022 04:53 UTC

hput <hputn3@zohomail.com>:
>Running: Ubuntu 20.04 linux with bash
>
>
>Some how I've managed to get a directory written with the name
>`--head--'. Haven't been able to figure out how this got written.

[…]

>I want to see it with a simple `ls' or `ls -l' command. A few of
>what I've tried:
>
>are:
>ls
>
> '--head--'
>
> \-\-head\-\-
>
> [\-][\-]head[\-][\-]

[…]

As Janis already pointed out, "ls" and most of the standard
utilities parse their argument list in the following manner:  They
look at each of its arguments, starting with the left most and
proceeding to the right:  If the argument starts with (at least) one
"-" then they consider it to be an option except when they are told
(see below) to not consider the remaining arguments as options.

In your use case "ls" would consider "--head--" as a (GNU long)
option.  In the case of a filename starting with a "-" that's a
problem (as you encountered).

But there is a remedy: the special option "--".  It tells the
utility, that all following arguments are not to be interpreted as
options, even if they look like an option, i. e. if they start with
a "-".

So the solution would be:  Before any non‐option arguments that you
supply to "ls" always put that special end‐of‐options‐option "--" into
the argument list:

ls -- the filenames you want to specify …

or

ls -l -- the filenames you want to specify …

This end‐of‐options‐option doesn't do any harm should it be not
necessary, but it helps avoiding such surprises.

It's become a habit of mine to always supply an
end‐of‐options‐option no matter whether I think it's necessary or
not.

For example, the command

ls -d [![:letter:]]*

will show all filenames in the current directory that don't start
with a letter or a ".".  If there happens to be a filename like
"--head--" it will be put into the argument list and interpreted as
an option.  Note:  If one looks at that command one might not know
whether in the current directory there happens to be a filename
"--head--".  That's why I wrote "no matter whether I /think/ it's
necessary or not".

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor