My Opera is closing 3rd of March

Raphael's Pflock

miscellaneous Opera, Debian, Media and German posts

Subscribe to RSS feed

Sensible handling of filenames with blanks (in bash scripts)

, , , ...

To make your bash script handle filenames with blanks better just put the following in a line above your file handling code:

IFS=$'\n'


This tells bash to interprete only newlines as file seperators. Useful for grep, find, etc. as parameters of a for-loop. Obviously not very helpful if you have multiple file names in a line.

Found in the BSD-Team Dresden Wiki