思科、华为路由器的 shell 是如何工作的?
在很多网关设备上,我们通过 ssh 或者 telnet 连接到设备上进行调试,不同厂家不同设备都会定制有不同的 shell 命令,比如华为的 WAP shell,一开始进入设备使用的是 WAP 的 shell,然而这个 shell 都是定制的,如果想要使用更多的命令则需要进入到 linux 之下才能使用 linux的命令,然而在 linux 下面也是不能使用 WAP 的命令。很想知道像这种特别定制的 shell 是如何工作的,怎么才能知道哪些命令实际上都是如何跟 linux 底层工作的。谢谢!
You can think that these manufacturers provide a new interface; you can also think that these manufacturers provide a middleware.
To put it simply, the level you can operate is not actually Linux, but an operation layer, such as the graphical interface of a web page. If the manufacturer is lazy enough or pursues high efficiency enough, it will not have this graphical interface for a long time and will instead give you a command line interface.
Clicking on the graphical interface actually executes a middleware script on the web page. This script is what really works. It will change the content under the Linux system, such as IP and routing.
If there is no graphical interface, then you execute cmd -A -B -C on the command line interface. This command line interface actually still calls the middleware.
For example, display interface e0/0 may actually execute ifconfig eth0; ethtool eth0; and then integrate the data and output it to you.
My previous company also did something similar. You can take a look: vyatta.
Cisco IOS: https://learningnetwork.cisco.com/thread/47297
Huawei VRP was not found - -In fact, there is not much information about Huawei VRP on the Internet,
The most important system program provided to users by the Linux system is the Shell command language interpreter. It doesn't
It belongs to the kernel part, but runs outside the core in user mode. Its basic function is to explain and
Execute various commands entered by the user to realize the interface between the user and the Linux core. After the system is initially started, kernel
Create a process for each end user to execute the Shell interpreter. Its execution process is basically
Follow the following steps: (1) Read the command line entered by the user from the keyboard. (2) Analyze the command with command
name is used as the file name, and other parameters are transformed into the
required for internal processing of the system call execve()Form. (3) The terminal process calls fork() to create a child process. (4) The terminal process itself uses the system
The system calls wait4() to wait for the child process to complete (if it is a background command, it does not wait). Dangzijin
calls execve() when the process is running, and the child process searches the directory for
based on the file name (i.e., the command name)Close the file (this is the file composed of the command interpreter program), transfer it into the memory, and execute the program (
Explain this command). (5) If there is an ampersand (background command symbol) at the end of the command, the terminal process
There is no need to wait for the system call wait4(), a prompt will be sent immediately, allowing the user to enter the next command, go to ⑴
. If there is no ampersand at the end of the command, the terminal process will have to wait until the child process (that is, run the command
The process of) terminates after completing the processing and reports to the parent process (terminal process). At this time, the terminal process wakes up
, after doing necessary judgment and other work, the terminal process sends a prompt to let the user enter a new command, and then restart
Repeat the above process.
http://www.cnblogs.com/wuyuegb2312/p/3399566.html