Use the tee command:
sh portal/ |tee
Get the script parent classpath
cmddir="`dirname $0`"
The above shell's implementation of recording the script output results to the log file is all the content I share with you. I hope it can give you a reference and I hope you support me more.