Macos 10.13.6, Julia 1.0.1, fish or bash shells (happens in both)
Code:
println(ARGS)
If called as
$ julia t.jl "arg1 arg2"
Returns
["arg1", "arg2"]
I expected the result to be ["arg1 arg2"]; this is also what an analogous Python program gives.
I can't reproduce. In fact, it seems we've consistently produced a single string as far back as 0.1:
$ julia-0.1 -E 'ARGS' "arg1 arg2"
{"arg1 arg2"}
$ julia-0.2 -E 'ARGS' "arg1 arg2"
{"arg1 arg2"}
$ julia-0.3 -E 'ARGS' "arg1 arg2"
UTF8String["arg1 arg2"]
$ julia-0.4 -E 'ARGS' "arg1 arg2"
UTF8String["arg1 arg2"]
$ julia-0.5 -E 'ARGS' "arg1 arg2"
String["arg1 arg2"]
$ julia-0.6 -E 'ARGS' "arg1 arg2"
String["arg1 arg2"]
$ julia-0.7 -E 'ARGS' "arg1 arg2"
["arg1 arg2"]
$ julia-1.0 -E 'ARGS' "arg1 arg2"
["arg1 arg2"]
The same happens for me if I put println(ARGS) in a file.
What OS are you trying it on? It seems to be restricted to Macos (works fine on Linux, at least).
macOS 10.13.6
That's weird. I see the bug with your variant of invocation as well; although it does not happen in julia 0.7. Do you have any ideas what else I can check?
Hm, not offhand, unfortunately... That's odd. So to confirm, just running julia -E 'ARGS' "arg1 arg2" for you produces ["arg1", "arg2"], correct?
Oh, I feel stupid now. I had a bash script set up that called Julia-1.0.1 adding some command-line arguments, and it had $@ instead of "$@". Julia-0.7 was just called via a link. Sorry for the confusion.
No worries. Glad you got it figured out 👍
Most helpful comment
Oh, I feel stupid now. I had a bash script set up that called Julia-1.0.1 adding some command-line arguments, and it had
$@instead of"$@". Julia-0.7 was just called via a link. Sorry for the confusion.