* How to delete .*.~undo-tree~ files?
@ 2024-06-12 10:04 Denis Bitouzé
2024-06-12 11:30 ` Marc Chantreux
0 siblings, 1 reply; 10+ messages in thread
From: Denis Bitouzé @ 2024-06-12 10:04 UTC (permalink / raw)
To: zsh-users
Hi,
I'm able to delete a given .~undo-tree~ file (created by an Emacs
package):
┌────
│ rm -f .foo.\~undo-tree\~
└────
But I couldn't find a way to delete in one go all of the them in the
current directory (even more so in subdirectories) .
Thanks for any hint.
--
Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 10:04 How to delete .*.~undo-tree~ files? Denis Bitouzé
@ 2024-06-12 11:30 ` Marc Chantreux
2024-06-12 12:20 ` Denis Bitouzé
0 siblings, 1 reply; 10+ messages in thread
From: Marc Chantreux @ 2024-06-12 11:30 UTC (permalink / raw)
To: Denis Bitouzé; +Cc: zsh-users
hello,
> ┌────
> │ rm -f .foo.\~undo-tree\~
> └────
You can also quote things instead of protecting each chars separately.
I have the feeling it's more readable because of the expectations brains
when you used non-bareword langages for years.
┌────
│ rm -f ".foo.~undo-tree~"
└────
regards,
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 11:30 ` Marc Chantreux
@ 2024-06-12 12:20 ` Denis Bitouzé
2024-06-12 12:25 ` Andreas Kähäri
0 siblings, 1 reply; 10+ messages in thread
From: Denis Bitouzé @ 2024-06-12 12:20 UTC (permalink / raw)
To: zsh-users
Le 12/06/24 à 13h30, Marc Chantreux a écrit :
>> ┌────
>> │ rm -f .foo.\~undo-tree\~
>> └────
>
> You can also quote things instead of protecting each chars separately.
> I have the feeling it's more readable because of the expectations
> brains when you used non-bareword langages for years.
>
> ┌────
> │ rm -f ".foo.~undo-tree~"
> └────
Indeed, thanks!
Anyway:
┌────
│ rm -f ".*.~undo-tree~"
└────
doesn't remove in mass all the .*.~undo-tree~ in my current directory.
Regards.
--
Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 12:20 ` Denis Bitouzé
@ 2024-06-12 12:25 ` Andreas Kähäri
2024-06-12 12:50 ` Denis Bitouzé
2024-06-12 13:11 ` Marc Chantreux
0 siblings, 2 replies; 10+ messages in thread
From: Andreas Kähäri @ 2024-06-12 12:25 UTC (permalink / raw)
To: Denis Bitouzé; +Cc: zsh-users
On Wed, Jun 12, 2024 at 02:20:27PM +0200, Denis Bitouzé wrote:
> Le 12/06/24 à 13h30, Marc Chantreux a écrit :
>
> >> ┌────
> >> │ rm -f .foo.\~undo-tree\~
> >> └────
> >
> > You can also quote things instead of protecting each chars separately.
> > I have the feeling it's more readable because of the expectations
> > brains when you used non-bareword langages for years.
> >
> > ┌────
> > │ rm -f ".foo.~undo-tree~"
> > └────
>
> Indeed, thanks!
>
> Anyway:
>
> ┌────
> │ rm -f ".*.~undo-tree~"
> └────
>
> doesn't remove in mass all the .*.~undo-tree~ in my current directory.
>
> Regards.
> --
> Denis
... because a quoted * does not glob anything.
rm -f .*.'~undo-tree~'
--
Andreas (Kusalananda) Kähäri
Uppsala, Sweden
.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 12:25 ` Andreas Kähäri
@ 2024-06-12 12:50 ` Denis Bitouzé
2024-06-12 17:46 ` Mark J. Reed
2024-06-12 13:11 ` Marc Chantreux
1 sibling, 1 reply; 10+ messages in thread
From: Denis Bitouzé @ 2024-06-12 12:50 UTC (permalink / raw)
To: zsh-users
Le 12/06/24 à 14h25, Andreas Kähäri a écrit :
> ... because a quoted * does not glob anything.
>
> rm -f .*.'~undo-tree~'
That did the trick, thanks!
--
Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 12:25 ` Andreas Kähäri
2024-06-12 12:50 ` Denis Bitouzé
@ 2024-06-12 13:11 ` Marc Chantreux
1 sibling, 0 replies; 10+ messages in thread
From: Marc Chantreux @ 2024-06-12 13:11 UTC (permalink / raw)
To: Denis Bitouzé, zsh-users
On Wed, Jun 12, 2024 at 02:25:52PM +0200, Andreas Kähäri wrote:
> > doesn't remove in mass all the .*.~undo-tree~ in my current directory.
to be more obvious:
those are equivalent:
echo ".*.~undo-tree~"
echo \.\*\.\~\u\n\d\o\-\t\r\e\e\~
regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 12:50 ` Denis Bitouzé
@ 2024-06-12 17:46 ` Mark J. Reed
2024-06-12 18:28 ` Ray Andrews
0 siblings, 1 reply; 10+ messages in thread
From: Mark J. Reed @ 2024-06-12 17:46 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
The usual trick works - just replace the "foo" with an asterisk while
leaving the rest alone, including the backslashes:
rm -f .*.\~undo-tree\~
As Andreas said, you can also write it like like this:
rm -f .*.'~undo-tree~'
Which ties back into those expectations from other languages that Marc
mentioned. It's important to remember that, unlike in those languages,
quotation marks are not token delimiters in the shell. They don't terminate
the current shell *word* (what other languages would just call a "string");
you can go in and out of quotes, switch kinds of quotes, etc. as often as
you like within a single word.
So .*.'~undo-tree~' is still just one string, even though only part of it
is in quotation marks. The part in quotes is not subject to glob
expansion; the part not in quotes is.
FWIW, if you want to do the same thing but recursing into subdirectories,
you can use the special recursive glob sequence * ***, as in
**/.*.'~undo-tree~'
On Wed, Jun 12, 2024 at 9:06 AM Denis Bitouzé <dbitouze@wanadoo.fr> wrote:
> Le 12/06/24 à 14h25, Andreas Kähäri a écrit :
>
> > ... because a quoted * does not glob anything.
> >
> > rm -f .*.'~undo-tree~'
>
> That did the trick, thanks!
> --
> Denis
>
>
--
Mark J. Reed <markjreed@gmail.com>
[-- Attachment #2: Type: text/html, Size: 2299 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 17:46 ` Mark J. Reed
@ 2024-06-12 18:28 ` Ray Andrews
2024-06-12 18:48 ` Bart Schaefer
0 siblings, 1 reply; 10+ messages in thread
From: Ray Andrews @ 2024-06-12 18:28 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
On 2024-06-12 10:46, Mark J. Reed wrote:
>
> Which ties back into those expectations from other languages that Marc
> mentioned. It's important to remember that, unlike in those languages,
> quotation marks are not token delimiters in the shell. They don't
> terminate the current shell /word/ (what other languages would just
> call a "string"); you can go in and out of quotes, switch kinds of
> quotes, etc. as often as you like within a single word.
>
> So .*.'~undo-tree~' is still just one string, even though only part of
> it is in quotation marks. The part in quotes is not subject to glob
> expansion; the part not in quotes is.
Pure curiosity, I have no problem to solve, but supposing you did want
to break the string up, I suppose you'd have to use an array? Then
perhaps manipulate the elements/words as desired, then recombine?
[-- Attachment #2: Type: text/html, Size: 1535 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 18:28 ` Ray Andrews
@ 2024-06-12 18:48 ` Bart Schaefer
2024-06-12 21:13 ` Ray Andrews
0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2024-06-12 18:48 UTC (permalink / raw)
To: Ray Andrews; +Cc: zsh-users
On Wed, Jun 12, 2024 at 11:28 AM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
>> On 2024-06-12 10:46, Mark J. Reed wrote:
>>
>> So .*.'~undo-tree~' is still just one string, even though only part of it is in quotation marks. The part in quotes is not subject to glob expansion; the part not in quotes is.
>
> Pure curiosity, I have no problem to solve, but supposing you did want to break the string up, I suppose you'd have to use an array? Then perhaps manipulate the elements/words as desired, then recombine?
I'm unclear what you mean by "break the string up".
Placing strings (quoted or not) adjacent to one another in shell is a
straight concatenation, just like separating strings with dot in perl
or plus in Javascript. Once they're concatenated any quoting is gone
and you just have a single string with no particular rules for how to
break it up again. You can't recover the original pieces.
So the only way to "break the string up" is never to put it together
in the first place. Using an array would be one way to do that, but
not necessarily the best way depending on where/how the substrings
originate.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to delete .*.~undo-tree~ files?
2024-06-12 18:48 ` Bart Schaefer
@ 2024-06-12 21:13 ` Ray Andrews
0 siblings, 0 replies; 10+ messages in thread
From: Ray Andrews @ 2024-06-12 21:13 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
On 2024-06-12 11:48, Bart Schaefer wrote:
> So the only way to "break the string up" is never to put it together
> in the first place. Using an array would be one way to do that, but
> not necessarily the best way depending on where/how the substrings
> originate.
Yeah, that has to be the answer. If I want to break up "Let me not, 'to
the m'"arriage of" true minds" into:
Le
te me n
ot, to th
e marriage
of true minds
... the parts would have to exist separately before concatenation cuz
once together there's no paper trail back to where the parts came from.
It's actually a dumb question even tho it's worth asking -- my array
would have to pre-exist in which case the elements would indeed be
delimited from each other. But you can't unscramble the egg.
[-- Attachment #2: Type: text/html, Size: 1502 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-12 21:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12 10:04 How to delete .*.~undo-tree~ files? Denis Bitouzé
2024-06-12 11:30 ` Marc Chantreux
2024-06-12 12:20 ` Denis Bitouzé
2024-06-12 12:25 ` Andreas Kähäri
2024-06-12 12:50 ` Denis Bitouzé
2024-06-12 17:46 ` Mark J. Reed
2024-06-12 18:28 ` Ray Andrews
2024-06-12 18:48 ` Bart Schaefer
2024-06-12 21:13 ` Ray Andrews
2024-06-12 13:11 ` Marc Chantreux
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).