I have a script that prompts the user for a response. How can I use the trap command to capture the question ask and the users response to a log file?
Thanks in advance,
I have a script that prompts the user for a response. How can I use the trap command to capture the question ask and the users response to a log file?
Thanks in advance,
trap 'printf "Say something: "; read A; echo $A > some_log_file; exit' 0
Or the Q and the A:
trap 'Q="Say something: "; printf "$Q"; read A; echo $Q $A > some_log_file; exit' 0