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

**URL:** https://discourse.julialang.org/t/how-to-execute-a-julia-code-in-a-shell-script-without-using-a-file-jl/30846
**Category:** General Usage
**Created:** [November 7, 2019, 10:04pm UTC](https://discourse.julialang.org/t/how-to-execute-a-julia-code-in-a-shell-script-without-using-a-file-jl/30846 "2019-11-07T22:04:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)
#### Post date: [November 7, 2019, 10:04pm UTC](https://discourse.julialang.org/t/how-to-execute-a-julia-code-in-a-shell-script-without-using-a-file-jl/30846/1 "2019-11-07T22:04:36Z")

</div>

Hello,

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

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

```

Thanks very much !

**NB :** I know that it is possible by using

```julia
#!/bin/sh
julia toto.jl

```

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

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [November 7, 2019, 10:09pm UTC](https://discourse.julialang.org/t/how-to-execute-a-julia-code-in-a-shell-script-without-using-a-file-jl/30846/2 "2019-11-07T22:09:44Z")

</div>

I guess you are looking for the `-e` and `-E` flags listed [here](https://docs.julialang.org/en/v1/manual/getting-started/).

---

<div class="post-metadata">

### Author: ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)
#### Post date: [November 7, 2019, 10:18pm UTC](https://discourse.julialang.org/t/how-to-execute-a-julia-code-in-a-shell-script-without-using-a-file-jl/30846/3 "2019-11-07T22:18:01Z")

</div>

Yes, this is exactly what I was looking for !

Thanks very much. 🙂
