How to run a custom function when starting an Erlang shell / node? (That is, a function within an `.erl` file)
what you probably want is erl -s module_name function_name
Note that you never specify the erlang file in the erl command like you did there in your example. The Erlang VM loads all modules in the codepath. That includes local directory.
From http://www.erlang.org/doc/man/erl.html:
-run Mod [Func [Arg1, Arg2, ...]] (init flag) Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as strings. See init(3).
-s Mod [Func [Arg1, Arg2, ...]] (init flag) Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as atoms. See init(3).