I have a situation where in I have a command in my shell script that must be executed after a exit command is executed in the same script (I know!! It sounds crazy!!)
I want to find a solution for something like
#!/bin/sh
ls -l ~/.
exit $?
touch ~/abc.txt
Here I want the command touch ~/abc.txt execute after exit $? has run and the command touch ~/abc.txt can be any command.
Constraints: 1) I cannot modify the exit $? part of the above script. 2) The command must be executed only after the exit $? command.
I'm not sure if there is a solution for this but any help is appreciated.
touchcommand? If you can modify the script, why can't you add it above theexit?