I have a file xyz.erl which contains a function fun1.I want want to call it from linux script.Any pointers?
You can create escript from your file. Follow the instructions
In brief, you should add call instructions for the shell and erlang to the begginig of you file
#!/usr/bin/env escript
%% -*- erlang -*-
Then make file executable.
Then you can call erlang script as conventional script. Note that you still required Erlang runtime installed to execute script.
Erlang calls main/1 function of the script but you can pass function name as an argument to call it
main([Fun]) ->
FunAtom = list_to_atom(Fun),
?MODULE:FunAtom().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With