Issues executing a bash script
Posted: 2011-11-01T13:49:25-07:00
This is my first time using imagemagick or even Unix-style scripts for that matter so feel free to berate me for stupid mistakes.
I am using Cygwin in Windows 7 to make this work. When I try to execute the .sh file posted below, I get a number of errors. I am simply trying to edit all the .png files in my home folder and then move the edited files to another folder. Any help (and of course, your patience with a luddite) is greatly appreciated.
Errors:
./IM_hero.sh: line 2: $'\r':command not found
./IM_hero.sh: line 3: syntax error near unexpected toke '$'\r' '
./IM_hero.sh: line 3: 'for f in *.png;
I am using Cygwin in Windows 7 to make this work. When I try to execute the .sh file posted below, I get a number of errors. I am simply trying to edit all the .png files in my home folder and then move the edited files to another folder. Any help (and of course, your patience with a luddite) is greatly appreciated.
Errors:
./IM_hero.sh: line 2: $'\r':command not found
./IM_hero.sh: line 3: syntax error near unexpected toke '$'\r' '
./IM_hero.sh: line 3: 'for f in *.png;
Code: Select all
#!/bin/bash
for f in *.png;
do
echo "Processing $f"
convert -set density 38 -units PixelsPerCentimeter \
-bordercolor white -border 1x1 \
-alpha set -channel RGBA -fuzz 3% \
-fill none -floodfill +0+0 white \
-shave 1x1 \
-blur 0x.3 \
-trim +repage \
-resize 230x375 \
$f ./edited_images/$f
done