archwhite
6/17/2016 - 1:52 PM

For Loop File Names With Spaces

For Loop File Names With Spaces

# FROM http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in *
do
  echo "$f"
done
IFS=$SAVEIFS