Link to home
Start Free TrialLog in
Avatar of alphaomega232
alphaomega232

asked on

shell scripting

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
Avatar of jolbe13
jolbe13

I cant really get your point. Can you be more explicit.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial