Reputation: 123
#!/bin/bash
cp ./Source/* ./Working/ 2> /dev/null
echo "Done"
for filename in *.zip;do unzip “$filename”;
done
In the above script, I am trying to copy all the files from source to working and unzip the files in working folder but I am geting igetting an error unexpected end of file
Upvotes: 1
Views: 1304
Reputation: 836
You have up to two problems here. First you quotes are not standard. You probably copy pasted from MS Word or something that automatically converts quotes.
The second problem you may have is that your filenames may have spaces in it. This can cause all sorts of problems in scripts if you do not expect it. There are a few workarounds but the easiest is probably to change the IFS:
OLDIFS=$IFS
IFS="$(echo -e '\t\n')" # get rid of the space character in the IFS
... do stuff ...
IFS=$OLDIFS
Upvotes: 0
Reputation: 72639
It looks like you have different kinds of double quotes in "$filename"
, make sure both are ASCII double quotes (decimal 34, hex 22). Try analyzing your script with
od -c scriptname
Upvotes: 3