# Why ERROR when -e or -E are used?

**URL:** https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928
**Category:** New to Julia
**Tags:** question
**Created:** [May 27, 2021, 1:45pm UTC](https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928 "2021-05-27T13:45:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)
#### Post date: [May 27, 2021, 1:45pm UTC](https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928/1 "2021-05-27T13:45:07Z")

</div>

How should `-e` or `-E` be used ?  
I’m getting `ERROR` even for commands that look legit.

Search gave pretty little, so I suspect something on my system, but even in a pristine bash:

```bash
bash --noprofile --norc
bash-4.4$ julia --startup-file=no -E 'a = 1'
ERROR: UndefVarError: a not defined
bash-4.4$ julia --startup-file=no -E '1;'
1

```

and all of this is typed, no copy/paste.  
Another one:

```julia
julia --startup-file=no -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'
ERROR: syntax: incomplete: premature end of input

```

All of these commands work fine in the REPL, same julia, same terminal.

```julia
julia> using InteractiveUtils; InteractiveUtils.versioninfo()
Julia Version 1.6.1

```

It’s not recent; Quote from old notes, using julia-1.5:

```julia
julia -e "using LanguageServer; runserver()"
ERROR: syntax: incomplete: **premature** end of input 
julia -e "using Plots; s=1"
ERROR: syntax: incomplete: **premature** end of input 
Weird. Searched. Nevermind.

```

Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [May 27, 2021, 2:00pm UTC](https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928/2 "2021-05-27T14:00:13Z")

</div>

All your examples work correctly for me on Linux in Julia 1.6.1. What system are you on, and how did you install Julia?

---

<div class="post-metadata">

### Author: ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)
#### Post date: [May 27, 2021, 2:30pm UTC](https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928/3 "2021-05-27T14:30:51Z")

</div>

Thanks for the answer. The system is openSUSE-Leap-15.2.  
With the [Generic Linux on x86 64bit](https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.1-linux-x86_64.tar.gz), downloaded binary [Download Julia](https://julialang.org/downloads/),  
it works, indeed.

Trying to automatize the procedure,  
I forgot to append `_build` to distinguish between the build tree and the install tree.  
(the prefix is the build directory; it should be different ?)

> **Procedure used to install the version that fails**
>
> ```bash
> bash
> 
> git fetch --all --prune
> git tag # to find the latest version
> 
> julia_version=1.6.1
> 
> git reset --hard #Forcibly remove any changes to any files under version control
> git clean -x -f -d #Forcibly remove any file or directory not under version control
> git checkout v$julia_version
> 
> # need to remove all files from the build 
> # (cf. https://github.com/JuliaLang/julia/blob/9f22a3b4ce9c38bc73d7fc82aa0d61e286162c1a/doc/build/build.md)
> # write prefix=/path/to/install/folder into Make.user and then run make install. 
> # If there is a version of Julia already installed in this folder, 
> # you should delete it before running make install.
> 
> build_dir=/usr/local/build/julia-${julia_version}
> echo $build_dir
> rm -rf ${build_dir}
> make O=${build_dir} configure
> # those errors are normal:
> # find: ‘/usr/local/build/julia-1.6.1/base’: No such file or directory
> # ...
> 
> cd ${build_dir}
> echo "prefix=${build_dir}" > Make.user
> make -j $(nproc)
> make install
> 
> # quit this shell, to cleanup variables
> exit
> 
> ```

Let me fix it and report back.

* * *

Edit:

> **procedure with separate build and install directories**
>
> ```bash
> bash
> 
> git fetch --all --prune
> git tag # to find the latest version
> 
> julia_version=1.6.1
> 
> git reset --hard #Forcibly remove any changes to any files under version control
> git clean -x -f -d #Forcibly remove any file or directory not under version control
> git checkout v$julia_version
> 
> # need to remove all files from the build 
> (cf. https://github.com/JuliaLang/julia/blob/9f22a3b4ce9c38bc73d7fc82aa0d61e286162c1a/doc/build/build.md)
> write prefix=/path/to/install/folder into Make.user and then run make install. 
> If there is a version of Julia already installed in this folder, you should delete it before running make install.
> 
> install_dir=/usr/local/build/julia-${julia_version}
> echo $install_dir
> rm -rf ${install_dir}
> build_dir=${install_dir}_build
> echo $build_dir
> rm -rf ${build_dir}
> make O=${build_dir} configure
> # those errors are normal:
> # find: ‘/usr/local/build/julia-1.6.0/base’: No such file or directory
> # ...
> 
> cd ${build_dir}
> echo "prefix=${install_dir}" > Make.user
> make -j $(nproc)
> make install
> 
> # quit this shell, to cleanup variables
> exit
> 
> ```

Same result.

---

<div class="post-metadata">

### Author: ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)
#### Post date: [May 27, 2021, 3:40pm UTC](https://discourse.julialang.org/t/why-error-when-e-or-e-are-used/61928/4 "2021-05-27T15:40:12Z")

</div>

In the end, a wrapper used to switch easily between versions did something like  
`/path/to/bin/julia $@`,  
Double quotes are needed around the `$@`:

```bash
#! /bin/sh
# ...
/path/to/bin/julia "$@"

```
