- 浏览: 981756 次
- 性别:
- 来自: 广州
最新评论
-
qingchuwudi:
有用,非常感谢!
erlang进程的优先级 -
zfjdiamond:
你好 这条命令 在那里输入??
你们有yum 我有LuaRocks -
simsunny22:
这个是在linux下运行的吧,在window下怎么运行escr ...
escript的高级特性 -
mozhenghua:
http://www.erlang.org/doc/apps/ ...
mnesia 分布协调的几个细节 -
fxltsbl:
A new record of 108000 HTTP req ...
Haproxy 1.4-dev2: barrier of 100k HTTP req/s crossed
之前erlang邮件列表的一个问题:
hi list,
I fellowed the otp document, but it failed.
# erl -s os cmd ls
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
[kernel-poll:false] [lock-checking]
{"init terminating in
do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
Thx,
Jeremy
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply
Reply to all
Forward
yerl@club-internet.fr to erlanging, erlang-questio.
show details 7/11/07
Reply
echo 'os:cmd("ls").' | erl
cheers
Y.
----Message d'origine----
>Date: Wed, 11 Jul 2007 14:06:43 +0800
>De: "Jeremy Chow" <erlanging@gmail.com>
>A: erlang-questions@erlang.org
>Sujet: [erlang-questions] how to call os:cmd("ls") from shell?
- Show quoted text -
>
>hi list,
>
>I fellowed the otp document, but it failed.
>
># erl -s os cmd ls
>
>Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
>[kernel-poll:false] [lock-checking]
>
>{"init terminating in
>do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}}
>
>Crash dump was written to: erl_crash.dump
>
>
>Thx,
>Jeremy
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@erlang.org
>http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply
Reply to all
Forward
Bengt Kleberg to erlang-questio.
show details 7/11/07
Reply
On 2007-07-11 08:06, Jeremy Chow wrote:
> hi list,
>
> I fellowed the otp document, but it failed.
>
> # erl -s os cmd ls
this will not work.
1 erl -s will bundle the arguments (ls) into a list as atoms.
os:cmd( [ls] ).
2 os:cmd/1 wants a string. os:cmd("ls").
one might think that
erl -run os cmd ls
will work since -run keeps the arguments as strings, but -run also
bundles all arguments into a single string.
so you have to write an interface module that calls os:cmd/1 for you.
bengt
--
Those were the days...
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
- Show quoted text -
参见init 文档:
-eval Expr
Scans, parses and evaluates an arbitrary expression Expr during system initialization. If any of these steps fail (syntax error, parse error or exception during evaluation), Erlang stops with an error message. Here is an example that seeds the random number generator:
% erl -eval '{X,Y,Z}' = now(), random:seed(X,Y,Z).'
This example uses Erlang as a hexadecimal calculator:
% erl -noshell -eval 'R = 16#1F+16#A0, io:format("~.16B~n", [R])' \
-s erlang halt
BF
If multiple -eval expressions are specified, they are evaluated sequentially in the order specified. -eval expressions are evaluated sequentially with -s and -run function calls (this also in the order specified). As with -s and -run, an evaluation that does not terminate, blocks the system initialization process.
-extra
Everything following -extra is considered plain arguments and can be retrieved using get_plain_arguments/0.
-run Mod [Func [Arg1, Arg2, ...]]
Evaluates the specified function call during system initialization. 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 strings. If an exception is raised, Erlang stops with an error message.
Example:
% erl -run foo -run foo bar -run foo bar baz 1 2
This starts the Erlang runtime system and evaluates the following functions:
foo:start()
foo:bar()
foo:bar(["baz", "1", "2"]).
The functions are executed sequentially in an initialization process, which then terminates normally and passes control to the user. This means that a -run call which does not return will block further processing; to avoid this, use some variant of spawn in such cases.
-s Mod [Func [Arg1, Arg2, ...]]
Evaluates the specified function call during system initialization. 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. If an exception is raised, Erlang stops with an error message.
Example:
% erl -s foo -s foo bar -s foo bar baz 1 2
This starts the Erlang runtime system and evaluates the following functions:
foo:start()
foo:bar()
foo:bar([baz, '1', '2']).
The functions are executed sequentially in an initialization process, which then terminates normally and passes control to the user. This means that a -s call which does not return will block further processing; to avoid this, use some variant of spawn in such cases.
Due to the limited length of atoms, it is recommended that -run be used instead.
还可以这样:
erl -noshell -eval 'os:cmd("ls").' -s init stop
但是因为没有shell所以目录的内容没有被列出来。
貌似没有最好的方案!!!
hi list,
I fellowed the otp document, but it failed.
# erl -s os cmd ls
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
[kernel-poll:false] [lock-checking]
{"init terminating in
do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
Thx,
Jeremy
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply
Reply to all
Forward
yerl@club-internet.fr to erlanging, erlang-questio.
show details 7/11/07
Reply
echo 'os:cmd("ls").' | erl
cheers
Y.
----Message d'origine----
>Date: Wed, 11 Jul 2007 14:06:43 +0800
>De: "Jeremy Chow" <erlanging@gmail.com>
>A: erlang-questions@erlang.org
>Sujet: [erlang-questions] how to call os:cmd("ls") from shell?
- Show quoted text -
>
>hi list,
>
>I fellowed the otp document, but it failed.
>
># erl -s os cmd ls
>
>Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
>[kernel-poll:false] [lock-checking]
>
>{"init terminating in
>do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}}
>
>Crash dump was written to: erl_crash.dump
>
>
>Thx,
>Jeremy
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@erlang.org
>http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply
Reply to all
Forward
Bengt Kleberg to erlang-questio.
show details 7/11/07
Reply
On 2007-07-11 08:06, Jeremy Chow wrote:
> hi list,
>
> I fellowed the otp document, but it failed.
>
> # erl -s os cmd ls
this will not work.
1 erl -s will bundle the arguments (ls) into a list as atoms.
os:cmd( [ls] ).
2 os:cmd/1 wants a string. os:cmd("ls").
one might think that
erl -run os cmd ls
will work since -run keeps the arguments as strings, but -run also
bundles all arguments into a single string.
so you have to write an interface module that calls os:cmd/1 for you.
bengt
--
Those were the days...
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
- Show quoted text -
参见init 文档:
-eval Expr
Scans, parses and evaluates an arbitrary expression Expr during system initialization. If any of these steps fail (syntax error, parse error or exception during evaluation), Erlang stops with an error message. Here is an example that seeds the random number generator:
% erl -eval '{X,Y,Z}' = now(), random:seed(X,Y,Z).'
This example uses Erlang as a hexadecimal calculator:
% erl -noshell -eval 'R = 16#1F+16#A0, io:format("~.16B~n", [R])' \
-s erlang halt
BF
If multiple -eval expressions are specified, they are evaluated sequentially in the order specified. -eval expressions are evaluated sequentially with -s and -run function calls (this also in the order specified). As with -s and -run, an evaluation that does not terminate, blocks the system initialization process.
-extra
Everything following -extra is considered plain arguments and can be retrieved using get_plain_arguments/0.
-run Mod [Func [Arg1, Arg2, ...]]
Evaluates the specified function call during system initialization. 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 strings. If an exception is raised, Erlang stops with an error message.
Example:
% erl -run foo -run foo bar -run foo bar baz 1 2
This starts the Erlang runtime system and evaluates the following functions:
foo:start()
foo:bar()
foo:bar(["baz", "1", "2"]).
The functions are executed sequentially in an initialization process, which then terminates normally and passes control to the user. This means that a -run call which does not return will block further processing; to avoid this, use some variant of spawn in such cases.
-s Mod [Func [Arg1, Arg2, ...]]
Evaluates the specified function call during system initialization. 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. If an exception is raised, Erlang stops with an error message.
Example:
% erl -s foo -s foo bar -s foo bar baz 1 2
This starts the Erlang runtime system and evaluates the following functions:
foo:start()
foo:bar()
foo:bar([baz, '1', '2']).
The functions are executed sequentially in an initialization process, which then terminates normally and passes control to the user. This means that a -s call which does not return will block further processing; to avoid this, use some variant of spawn in such cases.
Due to the limited length of atoms, it is recommended that -run be used instead.
还可以这样:
erl -noshell -eval 'os:cmd("ls").' -s init stop
但是因为没有shell所以目录的内容没有被列出来。
貌似没有最好的方案!!!
评论
2 楼
xiaolin0105
2008-02-05
我不想再碰erlang了。。。
1 楼
jackyz
2008-02-05
但是因为没有shell所以目录的内容没有被列出来。
erl -noshell -eval 'io:format("~s", [os:cmd("ls")]).' -s init stop
貌似是没有打印?
erl -noshell -eval 'io:format("~s", [os:cmd("ls")]).' -s init stop
貌似是没有打印?
发表评论
-
OTP R14A今天发布了
2010-06-17 14:36 2676以下是这次发布的亮点,没有太大的性能改进, 主要是修理了很多B ... -
R14A实现了EEP31,添加了binary模块
2010-05-21 15:15 3030Erlang的binary数据结构非常强大,而且偏向底层,在作 ... -
如何查看节点的可用句柄数目和已用句柄数
2010-04-08 03:31 4813很多同学在使用erlang的过程中, 碰到了很奇怪的问题, 后 ... -
获取Erlang系统信息的代码片段
2010-04-06 21:49 3473从lib/megaco/src/tcp/megaco_tcp_ ... -
iolist跟list有什么区别?
2010-04-06 20:30 6525看到erlang-china.org上有个 ... -
erlang:send_after和erlang:start_timer的使用解释
2010-04-06 18:31 8384前段时间arksea 同学提出这个问题, 因为文档里面写的很不 ... -
Latest news from the Erlang/OTP team at Ericsson 2010
2010-04-05 19:23 2013参考Talk http://www.erlang-factor ... -
对try 异常 运行的疑问,为什么出现两种结果
2010-04-05 19:22 2838郎咸武<langxianzhe@163.com> ... -
Erlang ERTS Async基础设施
2010-03-19 00:03 2517其实Erts的Async做的很不错的, 相当的完备, 性能又高 ... -
CloudI 0.0.9 Released, A Cloud as an Interface
2010-03-09 22:32 2471基于Erlang的云平台 看了下代码 质量还是不错的 完成了不 ... -
Memory matters - even in Erlang (再次说明了了解内存如何工作的必要性)
2010-03-09 20:26 3439原文地址:http://www.lshift.net/blog ... -
Some simple examples of using Erlang’s XPath implementation
2010-03-08 23:30 2048原文地址 http://www.lshift.net/blog ... -
lcnt 环境搭建
2010-02-26 16:19 2612抄书:otp_doc_html_R13B04/lib/tool ... -
Erlang强大的代码重构工具 tidier
2010-02-25 16:22 2484Jan 29, 2010 We are very happy ... -
[Feb 24 2010] Erlang/OTP R13B04 has been released
2010-02-25 00:31 1385Erlang/OTP R13B04 has been rele ... -
R13B04 Installation
2010-01-28 10:28 1385R13B04后erlang的源码编译为了考虑移植性,就改变了编 ... -
Running tests
2010-01-19 14:51 1483R13B03以后 OTP的模块加入了大量的测试模块,这些模块都 ... -
R13B04在细化Binary heap
2010-01-14 15:11 1507从github otp的更新日志可以清楚的看到otp R13B ... -
R13B03 binary vheap有助减少binary内存压力
2009-11-29 16:07 1665R13B03 binary vheap有助减少binary内存 ... -
erl_nif 扩展erlang的另外一种方法
2009-11-26 01:02 3216我们知道扩展erl有2种方法, driver和port. 这2 ...
相关推荐
1 "Lu Yi: How do you do? Dick: How do you do? Lu Yi: My name is Lu Yi. Dick: I'm Richard Green. Please call me Dick. Lu Yi: Glad to meet you. Dick: Nice to meet you, too." 2 "Zhou Ming: Excuse me, ...
「安全认证」How to Get Promoted:Developing Metrics to Show How Threat Intel Works - 恶意软件 数据安全 防火墙 身份管理 安全体系 安全漏洞
这些练习旨在帮助学习者掌握使用特殊疑问词(如what, who, where, when, why, how等)提问的正确方法,以及理解在不同情境下如何回应这些问题。通过反复练习,能有效提升英语口语交流能力,同时加深对特殊疑问句结构...
8. "I am from Hubei." 提问:Where are you from? 9. "I went to school late because I got up late." 提问:Why were you late for school? 10. "It is windy." 提问:What's the weather like? 11. "I am ...
1. 一般疑问句:Do you go to school from Monday to Friday? 否定回答:No, I don't. 2. 一般疑问句:Do you like to go to school very much? 肯定回答:Yes, we do. 3. 一般疑问句:Do they usually have lunch ...
+ How can I get to ……?:我怎样到达……呢? + Is there …… near here / in the neighborhood?:附近有……吗? + Which is the way to ……?:哪条是去……的路? * Showing the ways: + Go straight ...
Additional information includes the evolution of multimedia on Symbian OS from previous versions to the current (v9.5) and plans for the future. Chapters include: Architecture of Multimedia on ...
3. 提问:How are you going to the Great Wall? 回答:I’m going there by subway. 4. 提问:Are you going to the library? 回答:No, I am going to the cinema. 5. 提问:Does your sister like watching ...
call-block translation-profile incoming call_blocktranslated incoming called-number .direct-inward-dial port 0/0/0:23 ``` 4. **测试翻译规则**:为了确保规则生效,您可以使用以下命令测试翻译规则: ...
+ It’s going to rain tomorrow. (同义句:It’s going to be rainy tomorrow. It will rain tomorrow. It will be rainy tomorrow.) * 描述感受: + I like to swim in the sea. (同义句:I like swimming in ...
How: how did the data go missing? Now it’s personal: Inside Threat, Risk and Governance Mitigating the Threat: what tools can help Summary The inside threat is very real. Even the most motivated, ...
4. 见面问候:Nice to meet you. 回答:Nice to meet you, too. 5. 指示涂色:Colour it brown! Unit 3 Look at me! 1. 询问对方健康状况:How are you? 回答:I’m fine, thank you. 以及邀请上学:Let’s go to ...
While individual examples may come from one version or another the patterns outlined in this book are intended to be more generic and based on the common functionality available in all releases....
例如:"How far is it from your home to school?" (从你家到学校有多远?) - 练习题中:A: How far is it from here? B: It’s about two kilometres away. 以上就是特殊疑问句的基本用法及其在实际应用中的例子...
在"firebreath source control and how to call js function"这个主题中,我们将深入探讨FireBreath的源码管理以及如何在C++插件中调用JavaScript函数。 首先,源码控制是软件开发中的关键部分,它确保了团队成员...
- 句型:How old are you? 用来询问年龄,回答形式如I’m 12。 2. **询问颜色**: - 句型:What colour is it? 对单一物体的颜色提问,回答It’s yellow and white等。 - 句型:What colour are they? 询问复数...