As another answer rightly suggest, there is no "elixir" function in the interactive elixir shell (iex), so what you meant to do was to execute the elixir command from your system shell.
But, there are helpers in iex that can load files from the directory iex was started in—first a bit of setup, given we have a test.exs file in our current working directory with the following contents:
defmodule Test do
def greet(person) do
"Hi, #{person}!"
end
end
We could load that into our iex session by using the c/1 (compile file) helper from iex:
$ iex
Erlang/OTP 22 [erts-10.5.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Interactive Elixir (1.9.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> c("test.exs")
[Test]
iex(2)> Test.greet("Pau")
"Hi, Pau!"
iex(3)>
Other helpers in iex that might help you here is pwd that will print the working directory, and ls that will list the files in the current working directory—you can change the working directory by using the cd helper, that takes a directory as a sting as an argument.
elixir hello.exsfrom the shell, not insideiex.