Reproduced from--no flowering tree: http://blog.csdn.net/mycwq/article/details/16858805
The finishing is very complete, so brought over,
The Erlang shell is a tool that uses commands and Erlang interaction in command-line mode. The Erlang shell is powerful and can be directly compiled, loaded, executed, debugged, and so on, and can be used by the shell as a terminal for Erlang projects. This article will introduce the Erlang shell commands, and simply illustrate them as examples.
Opens the Help information for Erlang Shell, which becomes Chinese here. You can also look at the official documents
Shell function Help
[Plain]View PlainCopy
- Eshell V5.10.2 (abort with ^g)
- 1> Help ().
- * * Shell built-in commands * *
- B ()--Show all the bound variables
- E (N)--Repeat a query <N>
- F ()--Release all bound variables
- F (X)--releasing a variable of a binding
- H ()--Show previous actions
- History (N)--Set the number of bars before the Save Action command
- Results (N)--Sets the number of results of the operation before saving
- Catch_exception (Bool)--exception handling during the execution of the set
- V (N)--use the value of a query <N>
- RD (R,D)--Define a record
- RF ()--Remove all record
- RF (R)--Remove a record
- RL ()--Show all record
- RL (R)--Display a record information
- RP (term)--Displays all the contents of a tuple
- RR (file)--reads the record definition from a file or module
- * * C Module Command * *
- BT (PID)--shows the stack backtracking of a process
- C (File)--Compile and reload the module
- CD (Dir)--Change Working directory
- Flush ()--Refresh the mailbox (so the shell receives the message)
- Help ()--Information
- I ()--Display System Information
- Ni ()--Displays system information as well as I () and also includes system information for network nodes
- I (x, Y, z)--get information about a process with PID <X,Y,Z>
- L (module)--load or reload modules
- LC ([File])--Compile a list of Erlang modules
- LS ()--Displays the list of files in the current working directory
- LS (Dir)--Displays a list of files in a directory
- M ()--Displays the modules that have been loaded into the system
- M (Mod)--Display a module information
- Memory ()--Shows the allocation information
- Memory (T)--Displays an information about an allocation <T>
- NC (File)--Compile and load modules on all nodes
- NL (module)--reload module at all nodes
- PID (x, Y, z)-PID <X,Y,Z> acquisition of a process PID
- PWD ()--Show Current working directory
- Q ()--close Erlang shell
- Regs ()--Show registered process information
- Nregs ()--Displays registered process information as well as regs (), and also includes process information for network nodes
- XM (M)--find functions not defined in a module, unused functions, deprecated functions
- Y (file)--Compile the Yecc file (. Yrl)
- * * I module Command * *
- IH ()--Display the help information of the I module
- True
Shell Function Description
1. Show bound variables
B ()--Show all the bound variables
[Plain]View PlainCopy
- 1> [A,b,c] = [A.]
- [A]
- 2> B ().
- A = 1
- B = 2
- C = 3
- Ok
2. Repeat Query
E (N)--Repeating a query
[Plain]View PlainCopy
- 3> e (1).
- [A]
3. Release the binding variable
F ()--Release all bound variables
F (X)--releasing a variable of a binding
[Plain]View PlainCopy
- 4> A.
- 1
- 5> f (A).
- Ok
- 6> A.
- * 1:variable ' A ' is unbound
- 7> B.
- 2
- 8> f ().
- Ok
- 9> B.
- * 1:variable ' B ' is unbound
- 10> C.
- * 1:variable ' C ' is unbound
4. Using Query Results
V (N)--use the value of a query
[Plain]View PlainCopy
- 11> A1 = V (4).
- 1
- 12> A1.
- 1
5. Record operation
RD (R,D)--Define a record
RF ()--Remove all record
RF (R)--Remove a record
RL ()--Show all record
RL (R)--Display a record information
[Plain]View PlainCopy
- 13> Rd (person, {name, age, address, salary, children}).
- Person
- 14> Rd (Child, {name, age}).
- Child
- 15> RL ().
- -record (Child,{name,age}).
- -record (Person,{name,age,address,salary,children}).
- Ok
- 16> RL (Child).
- -record (Child,{name,age}).
- Ok
6. Display meta-group content
RP (term)--Displays all the contents of a tuple
The Erlang shell automatically omits tuples that have too long content and can be fully displayed using the RP command
[Plain]View PlainCopy
- 17> lists:seq (1,50).
- [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
- 23,24,25,26,27,28,29| ...]
- 18> RP (Lists:seq (1,50)).
- [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
- 23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,
- 43,44,45,46,47,48,49,50]
- Ok
7. Working directory
CD (Dir)--Change Working directory
PWD ()--Get working directory
[Plain]View PlainCopy
- 19> pwd ().
- D:/tmp
- Ok
- 20> CD ("d:/").
- d:/
- Ok
- 21> pwd ().
- d:/
- Ok
8. Process operation
Self ()--get current process PID
PID (x, Y, z)-PID <X,Y,Z> acquisition of a process PID
Exit (Pid)--Kill a process
Catch_exception (Bool)--exception handling during the execution of the set
Erlang shell Command Chinese user manual