Start julia with REPL, loading script, and passing arguments

922 views
Skip to first unread message

Josef Sachs

unread,
Feb 14, 2015, 8:18:41 PM2/14/15
to julia...@googlegroups.com
I am trying to start julia
(1) in interactive mode, i.e. with the REPL,
(2) loading a script, and
(3) passing command line arguments

I can accomplish (1) and (2) with
julia -i -L startup.jl
but I can't manage to pass additional arguments without producing an error.

juser@juliabox:~$ julia -i -L startup.jl foo bar
ERROR: could not open file /home/juser/foo
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
juser@juliabox:~$ echo $?
1

Is there any way I can accomplish this?

Stefan Karpinski

unread,
Feb 15, 2015, 2:31:50 PM2/15/15
to Julia Users, Jeff Bezanson
I'm not sure that we support this at the moment. The part that's not supported seems to be passing command-line arguments in interactive mode.

Devendra Ghate

unread,
Feb 15, 2015, 3:55:19 PM2/15/15
to julia...@googlegroups.com
Shouldn't `read(STDIN,arg1,arg2)` in the startup.jl work?

Devendra
--
Devendra Ghate

David van Leeuwen

unread,
Feb 16, 2015, 3:29:34 AM2/16/15
to julia...@googlegroups.com, jeff.b...@gmail.com
Hello, 

On Sunday, February 15, 2015 at 8:31:50 PM UTC+1, Stefan Karpinski wrote:
I'm not sure that we support this at the moment. The part that's not supported seems to be passing command-line arguments in interactive mode.

The command line args seem to be read all right, and seem to be available as ARGS (including the "-L" etc).  My assessment it that the all arguments are interpreted as files to be loaded at startup, rather than just the one following -L. 

Would an option "--" make sense to separate the start up files from arguments to be passed to the script/sessions. 

Stefan Karpinski

unread,
Feb 17, 2015, 1:11:43 PM2/17/15
to Julia Users, Jeff Bezanson
On Mon, Feb 16, 2015 at 3:29 AM, David van Leeuwen <david.va...@gmail.com> wrote:
Would an option "--" make sense to separate the start up files from arguments to be passed to the script/sessions. 

Yes, this is the right solution. I've opened two related issues:


Reply all
Reply to author
Forward
0 new messages