support files with spaces

pull/10/head
Raphaël Vinot 2013-03-29 02:42:01 +01:00
parent dcdbfb5401
commit feb05cc5ab
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e #set -e
#set -x set -x
source ./constraint.sh source ./constraint.sh
source ./constraint_conv.sh source ./constraint_conv.sh
@ -149,13 +149,14 @@ main(){
fi fi
fi fi
FILE_COMMAND='file -b --mime-type'
FILE_LIST=`find ${CURRENT_SRC} -type f` FILE_LIST=`find ${CURRENT_SRC} -type f`
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for file in ${FILE_LIST}; do for file in ${FILE_LIST}; do
# first param is the destination dir # first param is the destination dir
dest=${1} dest=${1}
mime=`$FILE_COMMAND ${file}` mime=`file -b --mime-type ${file}`
echo ${mime} echo ${mime}
main_mime=`echo ${mime} | cut -f1 -d/` main_mime=`echo ${mime} | cut -f1 -d/`
details=`echo ${mime} | cut -f2 -d/` details=`echo ${mime} | cut -f2 -d/`
@ -193,5 +194,6 @@ main(){
;; ;;
esac esac
done done
IFS=$SAVEIFS
} }