Lawrence D'Oliveiro
2024-08-13 08:26:41 UTC
I like having spaces in file/directory names, but I avoid putting newlines
in them.
This plays havoc with the shell’s word-splitting rules, because the
default value for IFS is
IFS=$' \t\n'
which means names with spaces in them get split into separate items,
triggering lots of errors about items not found (or the wrong items found/
created).
However, if you change this to
IFS=$'\n'
then this can make things much more convenient (provided you can be sure
there are no newlines in your file names). For example, I can do
ls -lt $(find . -type f -iname \*fred\*)
to search for all filenames containing “fred” in the hierarchy rooted at
the current directory, and display them in reverse chronological order.
in them.
This plays havoc with the shell’s word-splitting rules, because the
default value for IFS is
IFS=$' \t\n'
which means names with spaces in them get split into separate items,
triggering lots of errors about items not found (or the wrong items found/
created).
However, if you change this to
IFS=$'\n'
then this can make things much more convenient (provided you can be sure
there are no newlines in your file names). For example, I can do
ls -lt $(find . -type f -iname \*fred\*)
to search for all filenames containing “fred” in the hierarchy rooted at
the current directory, and display them in reverse chronological order.