On 2026-11-16 11:11, Mikael Magnusson wrote:
No doubt that the robust solution would be more like Stephane's. Anyway I think spaces in filenames is the work of the devil. I always preview the output to see that I'm getting an nice clean list before I throw it at another command. BTW, what I'm actually doing is concatenating a bunch of old emails, and I naturally want them in chronological order.This just moves the problem from white space in filenames breaking the script to newlines in filenames breaking the script, though. I would recommend never using ls to generate a list of filenames for use in a script, only for looking at the output with your eyeballs.