This may not be the correct forum at all, but since I haven't seen anything specific on the FreeBSD forum about this, I figured I'd start here...
I've been trying to write a script in the jail that parses through subdirectories looking for files of a specific type.
Here's the script
#!bin/sh
OLDIFS=$IFS
IFS=$'\n'
for FILENAME in $(find . -type f -name '*.mp4' -print0);do
echo $FILENAME
done
IFS=$OLDIFS
The problem is that if a file has a space in the name, it's delimits on the space. Normally in other *nix flavors I'd set IFS=$'\n' for a new line but this doesn't seem to work, rather it instead delimits on "\" or "n" <---obviously a problem. I've tried every which way to get this to work, done a ton of research into different loops methods using FreeBSD and IFS (which usually point back to what I have) and am just stumped why this isn't working as expected. The find returns correct results, so it's an issue with the for loop. Is this an issue with the freebsd version? Has any one else run into this or have a solution?
I've been trying to write a script in the jail that parses through subdirectories looking for files of a specific type.
Here's the script
#!bin/sh
OLDIFS=$IFS
IFS=$'\n'
for FILENAME in $(find . -type f -name '*.mp4' -print0);do
echo $FILENAME
done
IFS=$OLDIFS
The problem is that if a file has a space in the name, it's delimits on the space. Normally in other *nix flavors I'd set IFS=$'\n' for a new line but this doesn't seem to work, rather it instead delimits on "\" or "n" <---obviously a problem. I've tried every which way to get this to work, done a ton of research into different loops methods using FreeBSD and IFS (which usually point back to what I have) and am just stumped why this isn't working as expected. The find returns correct results, so it's an issue with the for loop. Is this an issue with the freebsd version? Has any one else run into this or have a solution?