Run another script

I have a script ( scitp1 ) that will check something in a file ( file1.txt ) , after run the script , it will pop the output , if it output "0" , it mean success , as below .
#script1 file1.txt
0
if I want to change the script1 , so that if the output is "0" , then run another script ( script2 ) , if not "0" , do nothing , can advise what can I do ?
Thanks .

Try something like this..

if [[ $(sh test.sh) == "0" ]]
then
sh test2.sh
fi

Try

[ $(script1 file1.txt) -eq "0" ] && script2

or, within script1, just before it outputs the variable containing "0", sth like

[ "$var" -eq "0" ] && script2

thanks reply , it works

But I just found that if the output contains "0" , it also proceed the script2 .

for example , if the output is as below , it still run script2 , can advise how to change it.

 
#test.sh
Permission denied
Permission denied
0

This is exactly what you asked for: