Yes that makes a lot more sense to me than the nasty awk and wc commands. I've got one more question. How do you nest an if/else statement within an if/elif chain....
Here's what this question is a larger part of. I want to nest that if/else within the elif but it keeps giving me the error:
unexpected EOF while looking for matching `"'
syntax error: unexpected end of file
And then the line number that corresponds to the line just after the end of the else statement. It doesn't matter if I put a fi in there or not it still produces the same result.
#!/bin/sh
filename=$1
MACHINE_TYPE=`uname -s`
if [ "$MACHINE_TYPE" == "Darwin" ]; then
echo "Yay, you're running a Macintosh"
elif [ "$MACHINE_TYPE" == "Linux" ]; then
echo "Yay, you're running a Linux box"
dir=/tmp/pov-Script
if [ -d $dir ] ; then
echo "do not create $dir"
else
echo "create $dir"
mkdir /tmp/pov-script
chmod 777 /tmp/pov-script
fi
cd /tmp/pov-script
pwd
curl -O
http://obelix.ca/xgrid/$filename".pov"
sleep 1
/opt/local/bin/povray $filename".pov" +W640 +H480
ls -la
curl -T $filename".png" -u user
ass -O \
ftp://obelix.ca/public_html/xgrid/$filename".png"
echo "Finished rendering scripts, they are available on the server"
fi