I’m failing to find answer to my problem. I need to be able to execute a shell command/bash script after the current one was exited with ^C.
In other words:
I’ve got a script which is running and just after I ^C from it I want another script or command to launch immediately after. How to achieve this?
I’ve tried ./first.sh; echo something with no luck.
I could try to run simultaneous scripts where one would be waiting/listening for the other to finish and then do the cleaning-up commands and also exit. But then I’d need a way of launching them in one command.
What would be the most appropriate approach to this problem?
Thanks
EDIT:
I think I’ve got it…
From the first script I can launch the other one with & at the end so it goes to the background. Seems to work with ^C exit from the first one (second continuous to work).
Any suggestions on better solutions?
./script1.sh && ./script2i.e. execute 2nd if 1st was successful../script1.sh || ./script2i.e. execute 2nd if 1st was NOT successful.or in script1 you could trap the exit signal and spawn the second process. Something like this:
s1:
s2:
session: