loading a table from file doesn't work unless inside erl shell

Matthias Lang matthias@REDACTED
Sun Apr 30 10:01:57 CEST 2006


If you'd posted a cut-down-but-still-working example of the problem as
well as some output showing what happens when you try and run it, then
it'd be a bit easier to see where you're getting stuck.

As plan B, looking at the alignment of Beta-centauri and using a
combination of modular theory and a Hebbian model of the brain, my
wild guess is that you're trying to pass arguments to your start
function and you're making incorrect assumptions about the format of
those arguments.

Can you run 'hello world' from bash? If you can do that, then you can
do anything, i.e. there's nothing special about ets. Here's an
example:

Here's hello world:

   -module(hw).
   -export([go/1]).

   go(X) ->
      io:fwrite("Hello world. My arguments are ~p\n", [X]).

After compiling this, you can run it from the command line:

   tmp >erl -noshell -s hw go five boxing wizards -s init stop
   Hello world. My arguments are [five,boxing,wizards]

Matthias

----------------------------------------------------------------------


Erik Garrison writes:
 > I've been attempting to use ets:file2tab and ets:tab2file to save/load
 > configuration options into a simulation environment I've created.
 > 
 > I can load a saved table from a file in the interactive shell, but I am
 > unable to do so in any program started from the command line using "erl
 > -run Mod Func".  I would like to be able to use a bash script to string
 > together a series of successive program runs, but unless I can load a
 > table from a file this will be impossible.
 > 
 > What am I missing?
 > 
 > -Erik Garrison



More information about the erlang-questions mailing list