ARGV[0] or how to get the “current command”

In most languages, we have access to an array or list called ARGV or similar. Where its first element is usually the actuall command that was used to invoke the script/program.

Is there something similar in elixir?

When building an escript the argv’s are passed into the initial function (CLIModule.main/1)

Well, given a C program foo, argv[0] is foo when started as foo, when started as /home/nobb/foo it will contain exactly that value. I’m searching for this bit of information inside my escript, I want to know how exactly my script was called.

:escript.script_name() maybe? Just guessing based on the escript docs.

1 Like

Thank you! I was unable to find that via google :wink: