I'm very new to Erlang. I've tried now several hours to find out how to run my sample scripts without the Erlang Shell.
I have installed E开发者_如何转开发rlang with Mac Ports, and I can access the Shell, write Scripts etc.
But I try to run my program in the Mac Terminal.
On this page [1] they are using ecc and elink. I don't have these programs in my installation.
Can you please provide me a way, how I can solve my problem?
Thanks and regards
chris
[1] http://www.sics.se/~joe/sae.html
You need to add:
#!/usr/bin/env escript
at the beginning of your script and make it executable (as @nomulous said):
chmod u+x myscript
Then you can run it like this:
./myscript
if it is in your current directory, or by giving its relative or full path otherwise, e.g.:
~/Desktop/myscript
Reference: the page you gave section Erlang Scripts
If your script is not executable, it won't run outside of the shell.
To make it executable, use chmod +x your_script_here
.
Try rebar (https://bitbucket.org/basho/rebar/wiki/Home) :)
精彩评论