投稿日 2019-05-31 22:53
kiyokawa's Blog
by
kiyokawa
At times, I'd like to perform an action against all files in a directory like this: for i in `find . -type f` do cp "${i}" "${i}.bak" done This fails when filenames contain spaces, as bash uses whitespace, tab and LF as the default delimiter. Solution? Do this: SAVEIFS=$IFS IFS=$(echo -en "\n\b")