Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.unix.programmer Subject: Re: Long filenames in DOS/Windows and Unix/Linux Date: Wed, 04 Sep 2024 03:44:32 -0700 Organization: None to speak of Lines: 36 Message-ID: <87ttevzoj3.fsf@nosuchdomain.example.com> References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <20240903084440.0000663d@gmail.com> <20240903103327.395@kylheku.com> <20240903113937.000008a3@gmail.com> <20240903130000.933@kylheku.com> <20240903132547.00000656@gmail.com> <87seug1iyj.fsf@nosuchdomain.example.com> <87o7541ggd.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 04 Sep 2024 12:44:33 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0c8cc2609bc8d9fbbbb3d106ce45f413"; logging-data="4005717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/i/gdMUTJ8tlF7JBmGiwcB" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:GQl2aTTgOwyaG3urOkP0tDJhB0k= sha1:e88zPxww5gmFj21G1yZdFPpgwiA= Xref: csiph.com comp.unix.programmer:16291 Ralf Fassel writes: > * Lawrence D'Oliveiro > | On Tue, 03 Sep 2024 16:10:42 -0700, Keith Thompson wrote: >> > | > Lawrence D'Oliveiro writes: > | >> > | >> On Tue, 03 Sep 2024 15:16:36 -0700, Keith Thompson wrote: > | >>> > | >>> For example, I might type something like: > | >>> > | >>> for file in * ; do cp -p $file $file.bak ; done > | >> > | >> It’s quite easy to fix that to work with spaces in file names. > | > > | > I wouldn't call it "quite easy". >> > | As easy as this, in Bash at least: >> > | IFS=$'\n' > > Forgive my ignorance, but what is wrong with > > for file in * ; do cp -p "$file" "$file.bak" ; done > > ? Works for both spaces and newlines in file names... (at least with > bash and ksh). You're absolutely right. I'm not sure how I missed that. (I was thinking that * just expands to a string, but that's obviously not the case.) D'oh! -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */