# How to exit Julia altogether from bash terminal?

**URL:** <https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360>\
**Category:** New to Julia\
**Created:** [January 2, 2025, 11:42am UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360 "2025-01-02T11:42:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [January 2, 2025, 11:42am UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/1 "2025-01-02T11:42:01Z")

</div>

Hello,  
I am launching a julia script with a bash script. How can I terminate the julia script so to go back into bash?  
I used `exit(0)` but the terminal remains in Julia…  
Thanks

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [January 2, 2025, 11:57am UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/2 "2025-01-02T11:57:13Z")

</div>

Can you please elaborate with a concrete [minimal working example](https://stackoverflow.com/help/minimal-reproducible-example) what you mean?

---

<div class="post-metadata">

**Author:** ![mike.ingold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike.ingold/32/203749_2.png) [@mike.ingold](https://discourse.julialang.org/u/mike.ingold)\
**Post date:** [January 2, 2025, 12:29pm UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/3 "2025-01-02T12:29:43Z")

</div>

It sounds like you’re hoping that Julia will `exit()` but also that the terminal hosting it in your OS will close. I don’t know if Julia can signal that behavior, but depending on your OS there are ways to spawn terminal processes (like `julia`) that will automatically close upon completion.

---

<div class="post-metadata">

**Author:** ![stephancb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephancb/32/14243_2.png) [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Post date:** [January 2, 2025, 1:34pm UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/4 "2025-01-02T13:34:17Z")

</div>

If I start julia in bash with

```julia
julia -- hallo.jl

```

where ‘hallo.jl’ has

```julia
println("hallo")

```

I get the bash prompt after the “hallo”. This is because the EOF of the script terminates julia, an explicit `exit()` is not needed.

a file ‘test.jl’ having

---

<div class="post-metadata">

**Author:** ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)\
**Post date:** [January 2, 2025, 4:34pm UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/5 "2025-01-02T16:34:47Z")

</div>

You can launch julia as `exec julia …` which will replace the bash process by the Julia one, so when returning from Julia it will close the terminal window

---

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [January 3, 2025, 8:01am UTC](https://discourse.julialang.org/t/how-to-exit-julia-altogether-from-bash-terminal/124360/6 "2025-01-03T08:01:56Z")

</div>

perfect, thank you!
