REPL-like printing from a script?



I often develop scripts in Atom or in the REPL before running them on a compute cluster. The cluster is configured with a node for submitting scripts and several compute nodes. I can’t log in directly to a compute node, I can only log in to the submitting node.

What I would like to do is to submit a Julia script that behaves, with respect to echoing of the input lines and printing the results of evaluation of expressions that do not end in ;, as if it were being run in the REPL.

Every time I want to do this I rediscover the -i option to julia then I rediscover that it doesn’t have the effect that I think it will.

Have I missed an obvious way of doing this?


This is also a feature I am looking for. It brings a lot convenience when reading the output.
However in Julia I always need to save the result to some other file.
R users can do this by R CMD BATCH -q test.R command and obtain an test.Rout file with the following contents

> x=rnorm(10)
> sum(x)
[1] 0.5408333
> summary(x)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-2.13200 -0.06448  0.39510  0.05408  0.56820  1.09800 
> x^2
 [1] 0.549164326 0.136527004 0.197366650 0.973028278 0.177064401 0.008556946
 [7] 1.205633041 4.543555171 0.371503038 0.013645094
> proc.time()
   user  system elapsed 
  0.134   0.026   0.147 
test.Rout (END)