I'd like to do the thing below:
- execute a command, commandA
- if commandA was executed successfully, get commandA as a string
- notify that commandA was executed successfully
To achieve step 2, what commands should be used?
commandA && lastcommand=<some skillful commands> && echo '$lastcommand was executed successfully!'
bash
doesn't have anything that does this automatically.Instead of trying to get the command, put it into a variable and execute that variable.