I am trying to edit a script I found online. The script is supposed to convert all files in a directory and place them in another directory (Using handbrake) but it only passes the first word of the file and not the subsequent words or the file extension
#!/bin/bash
SRC="/var/www/mediacenter/convert"
DEST="/var/www/mediacenter/converted"
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI
#PRESET = " -e x264 -E av_aac -q 22"
for FILE in "$SRC"/*
do
filename=$(echo $FILE | cut -f 1 -d '.')
extension="${filename##*.}"
filename="${filename%.*}"
echo $filename.$DEST_EXT
$HANDBRAKE_CLI -i "$FILE" -o $FILE.$DEST_EXT $PRESET
done
The echo works and I have tried quoting it but can't find the right combination.