Hello, I am trying to make a shell script to remove special characters, like {}()!,' etc. So far I have referenced a past question I asked here, however I get a strange error message:
-bash-3.2$ ./test2.sh
./test2.sh: line 7: unexpected EOF while looking for matching `"'
./test2.sh: line 10: syntax error: unexpected end of file
test2.sh
#!/bin/bash
shopt -s nullglob
for file in *
do
if [ -f "$file" ]; then
newfile="`echo $file | tr -d '[{}(),\!]' | tr -d "\'" | sed 's/_-_/_/g'`"
mv "$file" "$newfile"
fi
done
Not sure where I am going wrong on this one, the files are named like:
Folder - 01
Folder 02!
Folder(03)
Folder Four_Three
The desired output would be
Folder 01
Folder 02
Folder 03
Folder Four Three
Thank you in advance.