Gentoo Archives: gentoo-user

From: tuxic@××××××.de
To: Gentoo <gentoo-user@l.g.o>
Subject: [gentoo-user] Question about handling filenames with "illegal" characters...
Date: Thu, 16 Apr 2020 15:15:57
Message-Id: 20200416151545.m5kcgmuzi24jzd65@solfire
1 Hi,
2
3 a loop like this
4
5 for fn in asd* ; do
6 do_something $fn
7 done
8
9 fails, when a file is named like this:
10
11 List of OSses allowing spaces in filenames.txt
12
13 .
14
15 Normally I would replace the asd* with the according
16
17 find . -name 'asd*' -print0 | <more here>
18
19 but I got in trpuble, because "do_something"
20 now misunderstood the whole thing.
21
22 Is there a way to express $fn in a way, so that
23 do_something get one filename at a time and
24 whole thing does not is torn apart by some
25 not so nice filenames?
26
27 Cheers!
28 Meino

Replies