For maximum pedantry, it may be worth mentioning that filenames in typical Linux file systems can contain newline characters.
- 0 Posts
- 3 Comments
Joined 3 years ago
Cake day: June 12th, 2023
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
Wouldn’t
for i in "$LIST";just result in a single loop iteration with$ibeing the entirety of$LIST?


I’m pretty sure that IFS does not apply to quoted strings since word splitting happens before the quote removal (see Shell Expansion).
$ ( files=$(ls); IFS=$'\n' ; for x in $files; do echo $x; done ) file a.txt file b.txt plainfile.txt $ ( files=$(ls); IFS=$'\n' ; for x in "$files"; do echo $x; done ) file a.txt file b.txt plainfile.txt