The case of disappearing double dash

I have the following julia script:

#!/usr/bin/env julia
println(ARGS)

Heres’s the output if I run it with an -- argument:

18:41:14|~/tmp
λ ./main.jl -a --b -- c
["-a", "--b", "c"]

What happened to --?

Just in case, the Python version works as I’d expect

λ cat main.py
#!/usr/bin/env python3
import sys
print(sys.argv)

18:44:38|~/tmp
λ ./main.py -a --b -- c
['./main.py', '-a', '--b', '--', 'c']

From Getting Started · The Julia Language
The -- delimiter can be used to separate command-line arguments intended for the script file from arguments intended for Julia:

If you add a leading --, then the next one appears

>julia echoargs.jl -- -a -b -- -c
["-a", "-b", "--", "-c"]
4 Likes

Aha, that’s the issue! I fixed it by using the following shebang: #!/usr/bin/env -S julia --

1 Like