[erlang-questions] why not works command from shell

Hugo Mills hugo@REDACTED
Tue Dec 13 21:47:49 CET 2016


On Tue, Dec 13, 2016 at 07:52:48PM +0000, Sergey Safarov wrote:
> When executed following command from erl shell all works as expected
> 
> 1> inet_res:nslookup('example.org','in','a').

inet_res:nslookup/3

> [root@REDACTED ~]# erl -noshell -s inet_res nslookup 'example.org' 'in' 'a'
> {"init terminating in do_boot",{undef,[{inet_res,nslookup,[['example.org
> ',in,a]],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
> init terminating in do_boot ()

"         -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(3erl).
"

   Note the fourth sentence: "Otherwise it is assumed to be of arity 1 [...]"

so you're actually calling

inet_res:nslookup(['example.org', in, a]) (which doesn't exist)

   Hugo.

-- 
Hugo Mills             | Two things came out of Berkeley in the 1960s: LSD
hugo@REDACTED carfax.org.uk | and Unix. This is not a coincidence.
http://carfax.org.uk/  |
PGP: E2AB1DE4          |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161213/98084381/attachment.bin>


More information about the erlang-questions mailing list