Gentoo Archives: gentoo-user

From: tuxic@××××××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Question about handling filenames with "illegal" characters...
Date: Thu, 16 Apr 2020 16:15:59
Message-Id: 20200416161549.re4ergo4kf6gxynw@solfire
In Reply to: Re: [gentoo-user] Question about handling filenames with "illegal" characters... by Rich Freeman
1 On 04/16 11:29, Rich Freeman wrote:
2 > On Thu, Apr 16, 2020 at 11:19 AM Neil Bothwick <neil@××××××××××.uk> wrote:
3 > >
4 > > On Thu, 16 Apr 2020 17:15:45 +0200, tuxic@××××××.de wrote:
5 > >
6 > > > a loop like this
7 > > >
8 > > > for fn in asd* ; do
9 > > > do_something $fn
10 > > > done
11 > > >
12 > > > fails, when a file is named like this:
13 > > >
14 > > > List of OSses allowing spaces in filenames.txt
15 > > >
16 > >
17 > > do_something "$fn"
18 > >
19 >
20 > That, or use ${fn} - that might be more resistant to quotes in
21 > filenames though I haven't looked closely into that.
22 >
23 > If you look at most ebuilds they're full of quoted or braced variables
24 > for exactly this reason. If you want to stick spaces in your
25 > directory paths that is your mess to deal with, but Gentoo won't
26 > break.
27 >
28 > On a side note, if you have a directory full of crufty filenames the
29 > detox program is very useful for cleaning them up. Of course, that is
30 > invasive and you probably don't want to rely on that in your script.
31 >
32 > --
33 > Rich
34 >
35
36 Hi Rich,
37
38 these [CENSORED] filenames are mainly copies from the contents of
39 usbstick, which were previoysly filled using machines, which were
40 neither UNICES nor Linuxxes nor MacOSxxes ... you know what I mean.
41 I myself stick to sane filenames.
42
43 Detox is known to me. But for certain reasons I cannot change the
44 filenames now...I have to process them first.
45
46 Cheers!
47 Meino