3 ms·
for filename in *.txt ; do ... has no issue with spaces in filenames. If *.txt matches "foo bar.txt", then that's what the filename variable is set to. In the
by kazinator 11y ago
for filename in *.txt ; do ...
has no issue with spaces in filenames. If *.txt matches "foo bar.txt", then that's what the filename variable is set to. In the body of the loop you have to make sure you have "$filename".
You don't need play games with IFS to correctly process filesystem entry names expanded from a pattern.