I would like to execute a series of commands that compile my program. But it does not seem to be working. This is my script
#!/bin/bash
task[0] = $(cd vssl/make/; make clean;)
compile[0] = $(make all)
error[0] = $(echo "We failed at vssl install")
task[1] = $(cd ../../web/make/; make clean;)
compile[1] = $(make install)
error[1] = $(echo "We failed at web install")
eval "$task[0]"
if (eval "$compile[0]"); then
eval "$task[1]"
if (eval "$compile[1]"); then
echo "ALL DONE"
else
eval "$error[1]"
fi
else
eval "$error[0]"
fi
I have tried bunch of other methods, where I replace command declaration with this for example
task[0] = 'cd vssl/make/; make clean;'
This is just one error line, other lines say the same error But every time I get same errors saying
./install_everything.sh: line 4: task[0]: command not found
What exactly am I doing wrong here? I have tried simply substituting the actual command instead of variables like this
#!/bin/bash
cd vssl/make/
make clean
if(make all); then
cd ../../web/make/
make clean
if(make install); then
echo "ALL DONE"
else
echo "We failed at web install"
fi
else
echo "We failed at vssl install"
fi
And it worked perfectly. So I am quite stumped as to why my first method does not work.