unix commands return a value when they finish, you can pick up this value like this
[tt]
somecommand[tab][tab]# do something
retval=$?[tab][tab][tab]# pick up the value returned by 'somecommand'
You can try...
[tt]
comm1 && comm2 && comm3 && comm4
[tt]
... and it will run [tt]comm1[/tt] and if it returns 0 (true) then will run [tt]comm2[/tt] and if it returns 0 (true) then will run [tt]comm3[/tt] ... et cetera, or you can try
[tt]
command1
if [ $? ]
then
command2
if [ $? ]
then
command3
if [ $? ]
then
command4
fi
fi
fi
[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.