Hello everyone. I’m a new user who started with Julia just this week. (Windows 10/Julia 1.1.0) I began by going through the ‘Getting Started’ guide on julialang.org but came across a problem soon. When I try to run the basic script examples I see errors.
C:\Users\Navneeth\code\julia>julia -e 'println(PROGRAM_FILE); for x in ARGS; println(x); end' foo bar
ERROR: syntax: incomplete: invalid character literal
C:\Users\Navneeth\code\julia>echo 'println(PROGRAM_FILE); for x in ARGS; println(x); end' > script.jl
C:\Users\Navneeth\code\julia>julia script.jl foo bar
ERROR: LoadError: syntax: invalid character literal
Stacktrace:
[1] include at .\boot.jl:326 [inlined]
[2] include_relative(::Module, ::String) at .\loading.jl:1038
[3] include(::Module, ::String) at .\sysimg.jl:29
[4] exec_options(::Base.JLOptions) at .\client.jl:267
[5] _start() at .\client.jl:436
in expression starting at C:\Users\Navneeth\code\julia\script.jl:1
C:\Users\Navneeth\code\julia>
However when I replace the single quotes '
with double quotes "
, the first example works while the second one simply returns to the shell without errors.
C:\Users\Navneeth\code\julia>del script.jl
C:\Users\Navneeth\code\julia>julia -e "println(PROGRAM_FILE); for x in ARGS; println(x); end" foo bar
foo
bar
C:\Users\Navneeth\code\julia>echo "println(PROGRAM_FILE); for x in ARGS; println(x); end" > script.jl
C:\Users\Navneeth\code\julia>julia script.jl foo bar
C:\Users\Navneeth\code\julia>
Can anyone tell me why this is happening? I switched over to the notebooks at Juliabox to learn the basics and found that we cannot use single quotes to define strings. Does this have anything to do with these errors?