"escript: keine solche Datei oder das Verzeichnis:" Fehler
%cat Tatsache
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname factorial -mnesia debug verbose
main([String]) ->
try
N = list_to_integer(String),
F = fac(N),
io:format("factorial ~w = ~w\n", [N,F])
catch
_:_ ->
usage()
end;
main(_) ->
usage().
usage() ->
io:format("usage: factorial integer\n"),
halt(1).
fac(0) -> 1;
fac(N) -> N * fac(N-1).
%./Tatsache, "5"
escript: no such file or directory: './Tat'
%whereis escript
escript: /usr/bin/escript
%pacman -Qi erlang
name : erlang
version : R14B04-1
Warum doesnot escript ausgeführt "Tatsache" ?
Auf meinem Archlinux-box, escript noch doesnot Arbeit !
%cat hello.erl
main(_) -> io:fwrite("~p~n", "hello,world!").
%escript hello.erl
escript: no such file or directory: 'hello.erl'
%whereis escript
escript: /usr/bin/escript
%ls -l /usr/bin/escript
lrwxrwxrwx 1 root root 25 12月 18 17:37 /usr/bin/escript -> ../lib/erlang/bin/escript*
%/usr/lib/erlang/bin/escript hello.erl
escript: no such file or directory: 'hello.erl'
%strace -f -F -o aaa.txt /usr/lib/erlang/bin/escript hello.erl
escript: no such file or directory: 'hello.erl
%cat aaa.txt
execve("/usr/lib/erlang/bin/escript", ["/usr/lib/erlang/bin/escript", "hello.erl"], [/* 40 vars */]) = 0
...
open("hello.erl", O_RDONLY|O_LARGEFILE) = 3
...
execve("/usr/lib/erlang/bin/erl", ["/usr/lib/erlang/bin/erl", "+B", "-boot", "start_clean", "-noshell", "-run", "escript", "start", "-extra", "hello.erl"], [/* 40 vars */]) = 0.
...
stat64("hello.erl", 0xb5a44d90) = -1 ENOENT (No such file or directory)
open("hello.erl", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
......
Warum funktioniert es mit "stat64" statt "stat" ? Ich bin mit 32-bit-system.
%uname -a
Linux myarch 3.1.5-1-ARCH #1 SMP PREEMPT Sun Dec 11 06:26:14 UTC 2011 i686 AMD Athlon(tm) 64 X2 Dual Core Processor 3600+ AuthenticAMD GNU/Linux
%erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.8.5
GRÜßEN!
%ls
fact*
%escript fact "5"
escript: no such file or directory: 'fact'
%escript fact 5
escript: no such file or directory: 'fact
%ls -l /usr/bin/escript
lrwxrwxrwx 1 root root 25 10月 15 03:24 /usr/bin/escript -> ../lib/erlang/bin/escript*
Seltsames problem ?
Du musst angemeldet sein, um einen Kommentar abzugeben.
** HINWEIS * Diese Antwort ist speziell für Windows-Benutzer, aber verstanden werden kann und nützlich für andere opertaing system Benutzer
Ist
escript
im$PATH
Umgebungsvariable ? normalerweise ist es versteckt inERTS_PATH/bin
woERTS_PATH
ist inC:\Program Files (x86)\erl5.8.4\erts-5.8.4\
in Windows 7. suchen Sie für das äquivalent auf Linux-oder Unix oder MAC für erts. fügen Sie diesen Pfad (C:\Program Files (x86)\erl5.8.4\erts-5.8.4\bin
) der$PATH
. escript sollte in der Lage sein, überall zu arbeiten$ sudo find / -name "escript"
Der Grund ist SEHR einfach. Weil die folgende Zeile in ~/.erlang:
so, dass escript wird, ändern Sie das aktuelle Verzeichnis einmal ausgeführt. Das escript funktioniert Super nach dem entfernen dieser Zeile.
Beste Grüße!
Das gleiche script habe ich kopiert und es funktioniert.
Stellen Sie sicher, nachdem Sie Sie geschrieben haben das Skript, das Sie ausführen das Skript wie folgt
Ausführliche Informationen:
http://www.erlang.org/doc/man/escript.html
aktivieren, erlang, können sagen, erlang ist im root:
. /root/erlang/r15b01/aktivieren