|
|
|
|
|
by jolmg
1673 days ago
|
|
> A pain point in for loops is getting that right, e.g. there isn’t a good way to iterate over files with spaces in them using a for loop If those files came as arguments, you can use a for-loop as long as they're kept in an array: for f in "${files[@]}";
That handles even newlines in the filenames, while I'm not sure if you can handle that with a while-read-loop. IFS=$'\0' doesn't seem to cut it.for-loops seem preferable for working with filenames. If a command is generating the list, then something like `xargs -0` is preferable. |
|