Jump to content

Output of Failed Script


Recommended Posts

Posted

How can I print understand if my script fail without using debug ?

 

I want to performa a script and if fail ... perform an action

if success perform another action. 

 

 

 

Posted

Ok thanks.

isn't there a way to do it outside my script ? 

Because some of the script I use are used buy other systems and not Alfred exclusive

#! /bin/bash
./script1.bash
if [ $? -eq 0 ]
then
  echo "ok"
else
  echo "ko"
fi
echo "$?"
exit 0

 

Posted
1 hour ago, bm1x said:

isn't there a way to do it outside my script ?

 

Only by writing simple wrapper scripts as you’ve done there.

 

You probably only need to do “echo $?; exit 0” (no need for “echo ok”).

 

Downstream you can do “if {query} = 0”.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...