Liste des Groupes |
Ralf Fassel <ralfixx@gmx.de> writes:* Lawrence D'Oliveiro <ldo@nz.invalid>>
| On Tue, 03 Sep 2024 16:10:42 -0700, Keith Thompson wrote:>| > Lawrence D'Oliveiro <ldo@nz.invalid> 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!
Les messages affichés proviennent d'usenet.