How to execute a Julia code in a shell script without using a file jl?

Hello,

Is-it possible to execute a julia code inside a shell script by using something like:

#!/bin/sh
julia using Pkg ; Pkg.status() ; println("Hello the world !")

Thanks very much !

NB : I know that it is possible by using

#!/bin/sh
julia toto.jl

where the file toto.jl contains using Pkg ; Pkg.status() ; println("Hello the world !")

I guess you are looking for the -e and -E flags listed here.

4 Likes

Yes, this is exactly what I was looking for !

Thanks very much. :slight_smile: