
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 This is more robust than converting it to a stream and back, because inherently streams must be delimited, and the only bytes you can safely delimit unix dirents with are NULL and '/' -- the latter being used already within paths. PS: OK technically you could serialize to a stream using length-counting instead a la tar, but that's kind of obtuse in this context. PPS: mattcen's loop is not needed, as printf is variadic (at least in GNU): xs=$(printf %s\\n *)