I am looking at how to generically print in the Bash script the command input which has failed.
So instead of:
date -q || { echo "date -q"; return 1; }
I would like to have in my script something like
date -q || { echo !!; return 1; }
or
date -q || { fc -ln -1; return 1; }
Then, I can use compactly always the same code to print the command input which has failed in the script.
However, both attempts above, echo !!
and fc -ln -1
, do not solve the problem