How to instruct jshell to terminate at the end of the script similarly to interpreters of other languages like for example python3 or node
jshell
python3
node
Another possibility is to have an exit file:
exit.jsh
/exit
And then run:
./jshell --startup myscript.jsh --startup exit.jsh