
12 Nov
2011
12 Nov
'11
9:13 a.m.
On Fri, 11 Nov 2011, Trent W. Buck wrote:
Matthew Cengia wrote:
mattcen@tony:tmp$ files=$(for file in *; do printf "%s\n" "$file"; done)
Ahem. If you can guarantee bash, I humbly suggest using an array. The syntax is something like
xs=(*.mp3) # array of glob matches printf '"%s"\n' "${xs[@]}" # example use thereof
Hah! Where in the documentation does it specify that printf prints lines for each arg not sucked up by format strings, eg: printf "%s - %s" 1 2 3 1 - 2 3 - ? That's kinda neat, but kinda dangerous and contrary to the printf() I'm used to (which just ignores extra args and segfaults if there aren't enough of them). -- Tim Connors