im trying to write a script that should also output a log file of everything that happens. the command i found to do that is "script" but my "myscript.sh" exits after running "script" is there any way to prevent my shell script to exit?
"myscript.sh":
#!/bin/sh
timeStamp="$(date +%Y-%m-%d_%T)"
script script-install-edx-${timeStamp}.log
printf "question"
read answer
case $answer in
y|Y ) echo Yes
runAll=false
;;
n|N ) echo no
runAll=true
;;
* ) echo else;;
esac
First hit on google...
Bash script: Using "script" command from a bash script for logging a session
Script command opens a new shell, your script is still running in the background
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.