How would I write a script for the scriptfile “puzzlescript” to make the gotchascript echo back “gotcha”
? The idea here is to set up the first script named gotcha so that when $sum and $rightsum are equal
the script will echo back gotcha. It is set up to look at and execute the scriptfile ‘puzzlescript’
to see if its value is equal to $rightsum. Puzzlescript is set up in another part of the directory
and has to be written in such a way that when the gotchascript comes to run it, it triggers the echo
gotcha from the gotchascript.
#!/bin/bash
#gotchascript
if [ ~/puzzle ]
then
sum=` ~/puzzle 5 10 20 $$`
rightsum=`expr 35 + $$`
if [ $sum -eq $rightsum ]
then
echo gotcha
echo
fi
What I’ve come up with so far is,
#!/bin/bash
#puzzlescript
sum=`expr 5 + 10 + 20 + $$`
echo $sum
but it won’t cause the echo gotcha from the gotchascript