Jump to content
bm1x

Output of Failed Script

Recommended Posts

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. 

 

 

 

Share this post


Link to post

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

 

Share this post


Link to post
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”.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...