Command-line Options
These additional command-line arguments are passed in the global constant ARGS
. The name of the script itself is passed in as the global PROGRAM_FILE
. Note that ARGS
is also set when a Julia expression is given using the -e
option on the command line (see the julia
help output below) but PROGRAM_FILE
will be empty. For example, to just print the arguments given to a script, you could do this:
foo
Or you could put that code into a script and run it:
The --
delimiter can be used to separate command-line arguments intended for the script file from arguments intended for Julia:
$ julia --color=yes -O -- script.jl arg1 arg2..
Julia can be started in parallel mode with either the -p
or the --machine-file
options. -p n
will launch an additional n
worker processes, while --machine-file file
will launch a worker for each line in file file
. The machines defined in file
must be accessible via a password-less ssh
login, with Julia installed at the same location as the current host. Each machine definition takes the form [count*][user@]host[:port] [bind_addr[:port]]
. user
defaults to current user, port
to the standard ssh port. count
is the number of workers to spawn on the node, and defaults to 1. The optional bind-to bind_addr[:port]
specifies the IP address and port that other workers should use to connect to this worker.
If you have code that you want executed whenever Julia is run, you can put it in ~/.julia/config/startup.jl
:
Note that although you should have a ~/.julia
directory once you’ve run Julia for the first time, you may need to create the ~/.julia/config
folder and the ~/.julia/config/startup.jl
file if you use it.
julia [switches] -- [programfile] [args...]
The following is a complete list of command-line switches available when launching julia (a ‘*‘ marks the default value, if applicable):
Julia 1.1
In Julia 1.0, the default option did not search up from the root directory of a Git repository for the Project.toml
file. From Julia 1.1 forward, it does.