I\'d like to run an entire file with JShell like:
$ jshell my-jshell-skript.java
Where e.g. the content of my my-jshell-skript.java>
my-jshell-skript.java>
Launch jshell in concise feedback mode and filter the required content-
jshell
concise
$echo '40 + 2' | jshell --feedback concise | sed -n '2p' |sed -En 's/[^>]*>(.+)/\1/gp'
output: 42
42
More details here- How to execute java jshell command as inline from shell or windows commandLine