I have a situation where I have a command in my shell script that needs to be executed after the exit command is executed in the same script (I know !! That sounds crazy !!)
I want to find a solution for something like
#!/bin/sh ls -l ~/. exit $? touch ~/abc.txt
Here I want to execute the touch ~/abc.txt
after doing exit $?
, and touch ~/abc.txt
can be any command.
Limitations: 1) Can't I change the exit $?
part exit $?
the above script. 2) The command should be executed only after the exit $?
.
I am not sure if there is a solution for this, but any help is appreciated.
source share