Title here
Summary here
Command-line arguments are a common way to parameterize execution of programs. For example, elixir hello.exs
uses hello.exs
as an argument to the elixir
program.
To experiment with command-line arguments it’s best to save this code in a file (e.g., command_line_arguments.exs
) and run it with elixir
.
In Elixir, System.argv()
returns a list of command-line arguments, excluding the program name. To include the program name, we’ve used System.get_env("_")
, which typically contains the path to the Elixir interpreter.
Next, we’ll look at more advanced command-line processing with option parsing libraries in Elixir.