How to shutdown jshell at the end of the script?
Inside the script, use the jshell command /exit
.
This will exit jshell at the end of your script.
Check this reference https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm#JSHEL-GUID-465BA4F5-E77D-456F-BCB7-D826AC1E18AE
Another possibility is to have an exit file:
exit.jsh
/exit
And then run:
./jshell --startup myscript.jsh --startup exit.jsh