CN113504958A - Command execution method based on command line interface, electronic equipment and storage medium - Google Patents

Command execution method based on command line interface, electronic equipment and storage medium Download PDF

Info

Publication number
CN113504958A
CN113504958A CN202110571656.9A CN202110571656A CN113504958A CN 113504958 A CN113504958 A CN 113504958A CN 202110571656 A CN202110571656 A CN 202110571656A CN 113504958 A CN113504958 A CN 113504958A
Authority
CN
China
Prior art keywords
command
definition
target
file
execution result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110571656.9A
Other languages
Chinese (zh)
Inventor
李开科
石娜
刘薇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dawning Network Technology Co ltd
Original Assignee
Dawning Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dawning Network Technology Co ltd filed Critical Dawning Network Technology Co ltd
Priority to CN202110571656.9A priority Critical patent/CN113504958A/en
Publication of CN113504958A publication Critical patent/CN113504958A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a command execution method based on a command line interface, electronic equipment and a storage medium. The method comprises the following steps: the method comprises the steps of obtaining a first command input by a user on a command line interface, wherein the first command at least carries a command name and at least one command parameter, searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition, and executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command, so that the flexibility and the convenience of the use of the CLI are improved.

Description

Command execution method based on command line interface, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a command execution method based on a command line interface, an electronic device, and a storage medium.
Background
The Command Line Interface (CLI) is an Interface executed by a computer after receiving an instruction input by a User through a keyboard, and may also be referred to as a Character User Interface (CUI). CLI can conserve computer system resources compared to Graphical User Interfaces (GUIs). Therefore, the existing network devices often implement management and control of the network devices through a command line at present.
In the prior art, the CLI command is solidified in the code when the product is shipped, so that only the existing CLI command can be executed through the CLI, and the flexibility and the convenience of the use of the CLI are influenced.
Disclosure of Invention
The embodiment of the application provides a command execution method based on a command line interface, electronic equipment and a storage medium, and can improve the flexibility and convenience of using a CLI.
In a first aspect, a command execution method based on a command line interface is provided, including:
acquiring a first command input by a user on the command line interface, wherein the first command at least carries a command name and at least one command parameter; searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition; and executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command.
In one implementation, in a case that the target command definition includes a system command definition, executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command, includes: converting the first command into a system command format according to the at least one command parameter; and executing the converted first command to obtain an execution result of the first command.
In this embodiment, when a command interacting with the system needs to be executed, the electronic device converts the first command into a system command format according to the target command definition, and by executing the first command, the interaction with the system bottom layer is realized, so that the management and control capabilities of the network device are improved.
In one implementation, the method further comprises: acquiring a second command input by a user on the command line interface, wherein the second command carries a first command definition; in response to the second command, the first command definition is added to the temporary command file.
In this embodiment, the electronic device may add the first command definition to the temporary command file according to the second command of the user to supplement the solidified CLI command, so that the user can execute the command corresponding to the first command definition to implement the corresponding function, thereby improving flexibility and convenience in use of the CLI.
Optionally, any command definition includes: at least one of a command name, at least one command keyword, and a system command definition.
In one implementation, the method further comprises: and responding to the second command, and creating a first query file corresponding to the first command definition, wherein the first query file is used for saving the execution result of the command corresponding to the first command definition.
In this embodiment, the electronic device creates a corresponding first query file for the first command definition added to the temporary command file, so that the execution result of the subsequent command executed based on the first command definition can be stored in the first query file, and the execution result can be conveniently viewed.
In one implementation, the method further comprises: and storing the execution result of the first command in a target query file corresponding to the target command definition, wherein the target query file is used for storing the execution result of the command corresponding to the target command definition.
In this embodiment, the execution result of the first command is stored in the target query file corresponding to the target command definition, so that when the user requests to view the execution result, the corresponding execution result can be read by calling the target query file without obtaining the execution result again from the inside of the system, and the processing efficiency is improved.
In an implementation manner, the first command further carries a query file update parameter, where the query file update parameter is used to indicate that an execution result of the first command is newly added to the target query file, or indicate that content in the target query file is replaced with the execution result of the first command.
In a second aspect, an electronic device is provided, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first command input by a user on a command line interface, and the first command at least carries a command name and at least one command parameter; the command query unit is used for searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition; and the command execution unit is used for executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command.
In a third aspect, an electronic device is provided, including: a processor and a memory, the memory being configured to store a computer program, the processor being configured to invoke and execute the computer program stored in the memory to perform a method as in the first aspect or its implementations.
In a fourth aspect, there is provided a computer readable storage medium for storing a computer program for causing a computer to perform the method as in the first aspect or its implementations.
In a fifth aspect, there is provided a computer program product comprising computer program instructions to cause a computer to perform the method as in the first aspect or its implementations.
A sixth aspect provides a computer program for causing a computer to perform a method as in the first aspect or implementations thereof.
Based on the technical scheme, the electronic equipment searches the target command definition corresponding to the first command in the temporary command file, and executes the first command based on the target command definition and at least one command parameter carried in the first command.
Drawings
Fig. 1 is a schematic flowchart of a command execution method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a command adding method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another command execution method according to an embodiment of the present disclosure;
FIG. 4 shows a schematic block diagram of an electronic device according to an embodiment of the application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art without making any creative effort with respect to the embodiments in the present application belong to the protection scope of the present application.
The execution main body of the application is an electronic device with a display function, and the electronic device may be any terminal device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart sound box, a smart watch, and the like, but is not limited thereto. The electronic device may also be a server, which may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing services. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
In order to solve the problem that the flexibility and convenience of the use of the CLI are poor due to the fact that the CLI command solidified in the product code only can be executed in the factory in the prior art, the embodiment of the application provides a command execution scheme, and the CLI command is supplemented through at least one command definition in a temporary command file.
The present application is specifically illustrated by the following examples.
Fig. 1 is a flowchart illustrating a command execution method 100 according to an embodiment of the present disclosure. As shown in fig. 1, the method includes:
s101: acquiring a first command input by a user on a command line interface, wherein the first command at least carries a command name and at least one command parameter;
s102: searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition;
s103: and executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command.
It should be noted that the first command input by the user on the command line interface is a command that has been added with a command definition in the temporary command file in advance.
Optionally, each command definition in the temporary command file may correspond to a command of various functions, for example, a command definition for configuring a parameter of a network device, a command definition for querying, and the like.
Alternatively, the temporary command file may be a txt format file "TMP-cmd.
Optionally, any command definition including the target command definition at least includes at least one of a command name, at least one command keyword, and a system command definition.
For example, the command definition may be: RuleIPV4 SIP $ DIP $ SP $ DP $ PRO $ ACTION $ "ipv 4rule $$$", where RuleIPV4 is a command name, at least one command keyword sequentially includes a source Internet Protocol (IP) address SIP, a destination IP address DIP, a source port number SP, a destination port number DP, authority information PRO, and operation information ACTION, a parameter corresponding to each command keyword is replaced with $, and a parameter format may be a character string.
Optionally, when the system command definition is not included, the "inside" in the command definition is empty.
Optionally, the order of the plurality of parameters in the system command definition corresponds to the order of the at least one command key. Optionally, the plurality of parameters in the system command definition are separated by spaces.
Optionally, the command name carried by the first command is the same as or has a corresponding relationship with the command name in the target command definition.
For example, the user may select a command already defined in the temporary command file for execution according to the function to be implemented, and determine at least one command parameter required for executing the command according to the defined command. Further, the user may input a command to be executed, such as the first command in the present embodiment, in the command line interface.
For example, the user needs to configure the firewall, and the first command input may be: CMD RuleIPV4 SIP 1.1.1.1DIP 2.2.2SP 1000DP 2000 PROudp ACTION drop. Wherein CMD indicates that the first Command is a Command Prompt (CMD) Command, RuleIPV4 is a Command name, "1.1.1.1", "2.2.2", "1000", "2000", "UDP" and "drop" are Command parameters corresponding to at least one Command keyword, respectively, where the Command parameter "UDP" indicates that a User Datagram Protocol (UDP) "drop" indicates discarding.
The electronic device may look up a corresponding target command definition in the temporary command file according to the command name "RuleIPV 4", for example, the queried target command definition is RuleIPV4 SIP $ DIP $ DP $ PRO $ ACTION $ "ipv 4rule $ $ $ $ $ $".
For another example, the user needs to configure the data of the network device, and the input first command may be: CMD DeviceInfo Name 1 IP 10.10.10.10TYPE online, where DeviceInfo is a command Name, the device names "Name", "IP", and TYPE "are command keywords of the first command, and the device 1" device1 "," 10.10.10.10 ", and online" are command parameters corresponding to each command keyword, respectively.
The electronic device can query the temporary command file for a corresponding target command definition according to the command NAME "DeviceInfo", for example, the queried target command definition is DeviceInfo NAME $ IP $ TYPE $ ".
In the following, for two cases, that the target command definition corresponding to the first command includes a system command definition and does not include the system command definition, S103 is described as follows:
when the target command definition corresponding to the first command does not include the system command definition, the electronic device may obtain an execution result of the first command by executing the first command.
When the target command definition corresponding to the first command includes a system command definition, the electronic device may convert the first command into a system command format according to at least one command parameter, and execute the converted first command to obtain an execution result of the first command.
For example, the first command input by the user is CMD RuleIPV4 SIP 1.1.1.1DIP 2.2.2.2SP 1000DP 2000PRO ACTION drop, and the queried target command is defined as RuleIPV4 SIP $ DIP $ SP $ PRO $ ACTION $ ipv 1000DP $ ipv4rule $$$$$$$, then the electronic device converts the first command into ipv4rule 1.1.1.12.2.2.210002000 udp drop according to SIP 1.1.1.1DIP 2.2.2SP 1000DP 2000PRO ACTION drop in the first command, and then executes the converted first command.
In the embodiment of the application, the target command definition corresponding to the first command is searched in the temporary command file, and the first command is executed based on the target command definition and at least one command parameter carried in the first command.
Fig. 2 is a flowchart illustrating a command adding method 200 according to an embodiment of the present disclosure. As shown in fig. 2, the method includes:
s201: acquiring a second command input by a user on a command line interface, wherein the second command carries a first command definition;
s202: in response to the second command, the first command definition is added to the temporary command file.
For example, the second command that the user may enter at the command line interface may be an ADD-CMD command, and optionally, the format of the command may be ADD-CMD TMP-CMD-NAME TMP-cmdname PARA1NAME PARA2NAME … … SYS-CMD "system-CMD", where "TMP-CMD-NAME TMP-cmdname" is the key and value of the command NAME, "PARA PARA1 NAME" is the key and value of command key 1, "PARA PARA2 NAME" is the key and value of command key 2, and "SYS-CMD" system-CMD "is the key and value defined by the system command … ….
Based on the command format, the second command may be: ADD-CMD TMP-CMD-NAME RuleiPV4 PARA SIP PARA DIP PARA SP PARA DP PARA PRO PARA ACTION SYS-CMD "ipv 4rule $ $ $ $", or may be ADD-CMD TMP-CMD-NAME Deviceinfo PARA NAME PARA IP PARA TYPE.
For example, when the command definition has been written in the temporary command file, the electronic device may append the first command definition to the temporary command file without erasing other command definitions.
Txt can include the following, for example, the temporary command file TMP-cmd:
RuleIPV4 SIP$DIP$SP$DP$PRO$ACTION$“ipv4rule$$$$$$”
DeviceInfo NAME$IP$TYPE$“”
it should be understood that the first command definition may be any command definition in the temporary command file.
In this embodiment, the electronic device may add the first command definition to the temporary command file according to the second command of the user to supplement the solidified CLI command, so that the user can execute the command corresponding to the first command definition to implement the corresponding function, thereby improving flexibility and convenience in use of the CLI.
In some embodiments, after acquiring the second command, the electronic device may further create a first query file corresponding to the first command definition, where the first query file is used to store an execution result of the command corresponding to the first command definition.
It should be noted that each command definition in the temporary command file corresponds to one query file, and each query file is used for storing an execution result of a command corresponding to the corresponding command definition.
On the basis of the embodiment shown in fig. 1, in conjunction with fig. 3, after S103, the method 100 further includes:
s104: and saving the execution result of the first command in a target query file corresponding to the target command definition, wherein the target query file is used for saving the execution result of the command corresponding to the target command definition.
For example, after executing the first command CMD RuleIPV4 SIP 1.1.1.1DIP 2.2.2.2SP 1000DP 2000PRO udp ACTION drop, the contents of the target query file RuleIPV4.txt include:
----------------------RuleIPV4---------------------------------------
SIP:1.1.1.1
DIP:2.2.2.2
SP:10000
DP:20000
PRO:udp
ACTION:drop
for another example, after executing the first command CMD DeviceInfo Name device1 IP 10.10.10.10TYPE online, the contents of the target query file deviceinfo.txt include:
---------------------DeviceInfo--------------------------------------
NAME:device1
IP:10.10.10.10
TYPE:online
in some embodiments, the first command may further carry a query file update parameter, where the query file update parameter is used to indicate that an execution result of the first command is newly added to the target query file, or indicate that content in the target query file is replaced with the execution result of the first command.
For example, when the query file update parameter carried by the first command is add, the electronic device adds the execution result corresponding to the first command to the target query file, and does not erase the existing execution result; when the query file update parameter carried by the first command is rep (place), the electronic device replaces the content in the target query file with the execution result of the first command.
In this embodiment, the execution result of the first command is stored in the target query file corresponding to the target command definition, so that when the user requests to view the execution result, the corresponding execution result can be read by calling the target query file without obtaining the execution result again from the inside of the system, and the processing efficiency is improved.
In some embodiments, the electronic device may obtain a third command input by the user on the command line interface, where the third command carries a command name to be queried, and the electronic device displays, in response to the third command, a query command file corresponding to the command name to be queried.
Optionally, the third command may be a slow-CMD command, and the format of the third command may be a slow-CMD tmp-CMD name, for example, the third command may be: SHOW-CMD DeviceInfo, the electronic device responds to the third command, and displays the DeviceInfo and the corresponding query file, for example:
---------------------DeviceInfo--------------------------------------
NAME:device1
IP:10.10.10.10
TYPE:online
in this embodiment, the electronic device may display the execution result or the configuration information, the port information, and the like of the network device that needs to be queried to the user by querying the file, thereby improving the processing efficiency.
In some embodiments, the electronic device may obtain a fourth command input by the user on the command line interface, where the fourth command carries a command name corresponding to a command definition to be deleted, and in response to the fourth command, the electronic device searches for the command definition corresponding to the command name from the temporary command file, and deletes the command definition. The method and the device realize quick deletion of the command definition, are convenient for timely clearing errors or unused command definition, increase the flexibility of CLI command change and save the storage space.
Optionally, each implementation process in the foregoing embodiments may be implemented by executing a temporary command program, where the temporary command program may be a program that is pre-deployed in the CLI framework.
As a possible implementation manner, in this embodiment, the electronic device may add a definition of a temporary CLI command in an existing CLI frame by using a temporary command program, add the command definition in a temporary command file, create an inquiry file corresponding to the command definition, when obtaining the temporary CLI command input by a user in the CLI, search for the corresponding command definition in the temporary command file according to the CLI command, and execute the CLI command according to command parameters and the corresponding command definition carried in the CLI command input by the user; further, storing an execution result obtained by executing the CLI command in a pre-created query file, and displaying the content in the query file to a user when the user needs to query the execution result; further, when the user needs to delete any command definition in the temporary command file, the electronic device may query the temporary command file for the command definition corresponding to the command name by indicating the command name of the command definition and delete the command definition. In summary, the present embodiment can dynamically add a temporary command definition, so that the CLI command is more flexible, the CLI command solidified when the device leaves the factory can be supplemented without updating the software version, and meanwhile, the user can conveniently use the custom command, thereby improving the user experience.
While method embodiments of the present application are described in detail above with reference to fig. 1-3, apparatus embodiments of the present application are described in detail below with reference to fig. 4-5, it being understood that apparatus embodiments correspond to method embodiments and that similar descriptions may be had with reference to method embodiments.
Fig. 4 shows a schematic block diagram of an electronic device 400 according to an embodiment of the application. As shown in fig. 4, the electronic device 400 includes:
an obtaining unit 410, configured to obtain a first command input by a user on a command line interface, where the first command at least carries a command name and at least one command parameter;
a command query unit 420, configured to search a temporary command file for a target command definition corresponding to the command name, where the temporary command file includes at least one command definition;
the command executing unit 430 is configured to execute the first command according to the at least one command parameter and the target command definition, and obtain an execution result of the first command.
In some embodiments, the command execution unit 430 is specifically configured to:
converting the first command into a system command format according to the at least one command parameter;
and executing the converted first command to obtain an execution result of the first command.
In some embodiments, the obtaining unit 410 is further configured to: acquiring a second command input by a user on the command line interface, wherein the second command carries a first command definition; the command execution unit 430 is further configured to add the first command definition to the temporary command file in response to the second command.
Optionally, any command definition includes: at least one of a command name, at least one command keyword, and a system command definition.
In some embodiments, the command execution unit 430 is further configured to: and responding to the second command, and creating a first query file corresponding to the first command definition, wherein the first query file is used for saving the execution result of the command corresponding to the first command definition.
In some embodiments, electronic device 400 further comprises: the storage unit 440 is configured to store an execution result of the first command in a target query file corresponding to the target command definition, where the target query file is used to store an execution result of a command corresponding to the target command definition.
Optionally, the first command further carries an update parameter of the query file, where the update parameter of the query file is used to indicate that the execution result of the first command is newly added to the target query file, or indicate that the content in the target query file is replaced by the execution result of the first command.
The electronic device provided by the above embodiment may execute the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device 500 according to an embodiment of the present application. The terminal device shown in fig. 5 includes a processor 510, and the processor 510 can call and run a computer program from a memory to implement the method in the embodiment of the present application.
Optionally, as shown in fig. 5, the electronic device 500 may further include a memory 520. From the memory 520, the processor 510 can call and run a computer program to implement the method in the embodiment of the present application.
The memory 520 may be a separate device from the processor 510, or may be integrated into the processor 510.
Optionally, as shown in fig. 5, the electronic device 500 may further include a transceiver 530, and the processor 510 may control the transceiver 530 to communicate with other devices, and in particular, may transmit information or data to the other devices or receive information or data transmitted by the other devices.
The transceiver 530 may include a transmitter and a receiver, among others. The transceiver 530 may further include one or more antennas.
Optionally, the electronic device 500 may implement a corresponding process corresponding to the terminal device in each method of the embodiment of the present application, and for brevity, details are not described here again.
It should be understood that the processor of the embodiments of the present application may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It will be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous link SDRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that the above memories are exemplary but not limiting illustrations, for example, the memories in the embodiments of the present application may also be Static Random Access Memory (SRAM), dynamic random access memory (dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (enhanced SDRAM, ESDRAM), Synchronous Link DRAM (SLDRAM), Direct Rambus RAM (DR RAM), and the like. That is, the memory in the embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The embodiment of the application also provides a computer readable storage medium for storing the computer program.
Optionally, the computer-readable storage medium may be applied to a terminal device or a server in the embodiment of the present application, and the computer program enables a computer to execute corresponding processes in each method in the embodiment of the present application, which is not described herein again for brevity.
Embodiments of the present application also provide a computer program product comprising computer program instructions.
Optionally, the computer program product may be applied to a terminal device or a server in the embodiment of the present application, and the computer program instructions enable a computer to execute corresponding processes in each method in the embodiment of the present application, which is not described herein again for brevity.
The embodiment of the application also provides a computer program.
Optionally, the computer program may be applied to the terminal device or the server in the embodiment of the present application, and when the computer program runs on a computer, the computer is enabled to execute corresponding processes in each method in the embodiment of the present application, and for brevity, details are not described here again.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. With regard to such understanding, the technical solutions of the present application may be essentially implemented or contributed to by the prior art, or may be implemented in a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A command execution method based on a command line interface is characterized by comprising the following steps:
acquiring a first command input by a user on the command line interface, wherein the first command at least carries a command name and at least one command parameter;
searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition;
and executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command.
2. The method of claim 1, wherein in the case that the target command definition includes a system command definition, the executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command comprises:
converting the first command into a system command format according to the at least one command parameter;
and executing the converted first command to obtain an execution result of the first command.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
acquiring a second command input by a user on the command line interface, wherein the second command carries a first command definition;
in response to the second command, adding the first command definition to the temporary command file.
4. The method of claim 3, wherein any command definition comprises: at least one of a command name, at least one command keyword, and a system command definition.
5. The method of claim 3, further comprising:
and responding to the second command, and creating a first query file corresponding to the first command definition, wherein the first query file is used for saving an execution result of the command corresponding to the first command definition.
6. The method of claim 5, further comprising:
and storing the execution result of the first command in a target query file corresponding to the target command definition, wherein the target query file is used for storing the execution result of the command corresponding to the target command definition.
7. The method according to claim 6, wherein the first command further carries a query file update parameter, and the query file update parameter is used to indicate that an execution result of the first command is added to the target query file, or indicate that a content in the target query file is replaced by the execution result of the first command.
8. An electronic device, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first command input by a user on a command line interface, and the first command at least carries a command name and at least one command parameter;
the command query unit is used for searching a target command definition corresponding to the command name from a temporary command file, wherein the temporary command file comprises at least one command definition;
and the command execution unit is used for executing the first command according to the at least one command parameter and the target command definition to obtain an execution result of the first command.
9. An electronic device, comprising: a processor and a memory for storing a computer program, the processor being configured to invoke and execute the computer program stored in the memory to perform the method of any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program which causes a computer to perform the method of any one of claims 1 to 7.
CN202110571656.9A 2021-05-25 2021-05-25 Command execution method based on command line interface, electronic equipment and storage medium Pending CN113504958A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110571656.9A CN113504958A (en) 2021-05-25 2021-05-25 Command execution method based on command line interface, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110571656.9A CN113504958A (en) 2021-05-25 2021-05-25 Command execution method based on command line interface, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113504958A true CN113504958A (en) 2021-10-15

Family

ID=78009424

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110571656.9A Pending CN113504958A (en) 2021-05-25 2021-05-25 Command execution method based on command line interface, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113504958A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170270091A1 (en) * 2016-03-18 2017-09-21 Vmware, Inc. System and method for processing command line interface commands
CN108647043A (en) * 2018-04-03 2018-10-12 烽火通信科技股份有限公司 A kind of realization method and system of order line input

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170270091A1 (en) * 2016-03-18 2017-09-21 Vmware, Inc. System and method for processing command line interface commands
CN108647043A (en) * 2018-04-03 2018-10-12 烽火通信科技股份有限公司 A kind of realization method and system of order line input

Similar Documents

Publication Publication Date Title
US20180107725A1 (en) Data Storage Method and Apparatus, and Data Read Method and Apparatus
CN109697071B (en) Installation package synthesis method, device, terminal and storage medium
KR20190048364A (en) Method for modeling network system instructions with yang language and apparatus for the same
WO2019134340A1 (en) Salary calculation method, application server, and computer readable storage medium
KR101198437B1 (en) Method, apparatus and computer program product for providing context triggered distribution of context models
CN110019024B (en) Directory query method, system, electronic device and storage medium
WO2021128903A1 (en) Method and system for accelerating reading of information of field replace unit, device and medium
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
US9092499B2 (en) Synchronizing endpoint data stores having disparate schemas
CN103955361A (en) Modular development and publishing system for automatic compiling and establishing of web front-end codes
CN110727417B (en) Data processing method and device
CN114611481A (en) Template configuration method and device, computer equipment and storage medium
CN115470156A (en) RDMA-based memory use method, system, electronic device and storage medium
WO2019071406A1 (en) Front-end page internationalization processing method, application server and computer readable storage medium
US11656975B2 (en) System and method for automatically generating executable tests in Gherkin format
CN113504958A (en) Command execution method based on command line interface, electronic equipment and storage medium
CN112367195A (en) Network configuration method, system and device
CN116208676A (en) Data back-source method, device, computer equipment, storage medium and program product
KR20150116720A (en) Memory System and Electronic device including memory system
CN112395245B (en) Access device and method of processor and computer equipment
US7792921B2 (en) Metadata endpoint for a generic service
CN114329152A (en) Application program generation method, device, equipment and medium based on browser engine
US10866816B2 (en) Method and apparatus for automated feed processing
CN114154031A (en) Paging display method, device, equipment and storage medium for tree-shaped folding table
US11709805B2 (en) System and method for PaaS cloud ready random access report generation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20211015

RJ01 Rejection of invention patent application after publication