Shell script log printing method and device, electronic device and storage medium

By loading the log function in the shell script, recording and marking the success or failure information of the command execution, the problem of inconvenient logging in the existing technology is solved, instant exit and quick error troubleshooting are realized when the command fails, and the execution of the script is improved. reliability and efficiency.

CN113391942BActive Publication Date: 2024-10-29WUXI CHINAC DATA TECH SERVICE
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110679107.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-18
Publication Date
2024-10-29
Estimated Expiration
2041-06-18

AI Technical Summary

Technical Problem

It is difficult to conveniently record logs during the execution of existing shell scripts, which makes it difficult to locate problems in long scripts. Especially when command execution fails, the error rate is high and the troubleshooting efficiency is low.

Method used

By loading the log function, successful or failed operation information is recorded to a separate log file when the command is executed, and the results are displayed with color marks on the screen. If the command fails, the program will be exited immediately, ensuring that the error rate is reduced and log queries are simplified.

Benefits of technology

It effectively reduces the error rate. By recording information such as time, user and program name in real time, it is convenient to quickly query and correct errors, simplifying the operation process and improving troubleshooting efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113391942B_ABST
    Figure CN113391942B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for printing logs of a shell script, an electronic device and a storage medium, comprising the following steps: loading a log function in a shell script; obtaining a command under an operating system; executing the command; judging whether the command is executed successfully according to the log function in the shell script; if the command is executed successfully, recording the successful operation of the command according to the success function in the log function to a log file, and continuing to execute the next command; and if the command fails to be executed, recording the failed operation of the command according to the failure function in the log function to the log file, and exiting the program. According to the method for printing logs of a shell script of the present invention, when the script fails to execute a command, the program can be exited immediately, and the error rate can be minimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of computer technology, and in particular to a shell script log printing method and device, electronic equipment and storage medium. Background Art

[0002] Shell script uses the command interpretation function of Shell to parse a plain text file and then execute these functions. It can also be said that Shell script is a collection of a series of commands. Shell can be used directly on Windows, Unix or Linux systems, and can call a large number of internal system functions to interpret and execute programs, making computer operations more convenient. At present, it is not very convenient for shell scripts to log each step to the main program file during execution, and the script will not terminate until all commands are executed. Especially when the script is long, it is difficult to find the cause of the problem after the execution.

[0003] The information disclosed in this background technology section is only intended to enhance the understanding of the overall background of the invention and should not be regarded as an acknowledgment or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention

[0004] The object of the present invention is to provide a shell script log printing method, which can immediately exit the program when the script execution command fails, thereby reducing the error rate to a minimum.

[0005] To achieve the above object, an embodiment of the present invention provides a shell script log printing method, comprising the following steps:

[0006] Load the log function in the shell script;

[0007] Get commands under the operating system;

[0008] executing said command;

[0009] Determine whether the command is executed successfully according to the log function in the shell script;

[0010] If the command is executed successfully, the successful operation of the command is recorded in the log file according to the success function in the log function, and the next command is executed;

[0011] And if the command execution fails, the failure operation of the command is recorded in the log file according to the failure function in the log function, and the program is exited.

[0012] In one or more embodiments of the present invention, continuing to execute the next command includes the following steps: repeating the shell script log printing method until the program is exited or there is no next command to be executed.

[0013] In one or more embodiments of the present invention, the log file is a separate file independent of the shell script main program.

[0014] In one or more embodiments of the present invention, if the log function determines that the command is executed successfully, the current information of the command is obtained and the executed command is printed on the current screen with a green font color, and the current information of the successful command is recorded in the log file.

[0015] In one or more embodiments of the present invention, if the log function determines that the command execution fails, the current information of the command is obtained and the executed command is printed on the current screen with a red font color, and the current information of the failed command is recorded in the log file.

[0016] In one or more embodiments of the present invention, the current information includes the current time, the current executing user and the current program name.

[0017] In one or more embodiments of the present invention, the operating system is a Windows, Unix or Linux operating system.

[0018] To achieve the above object, the present invention also provides a method for executing a log function, comprising the following steps:

[0019] Get the log directory;

[0020] Execute the obtained command and generate a new file in the log directory to record the current program information;

[0021] Get the return information of the execution command to determine whether the execution command is successful;

[0022] If successful, enter the success function, obtain the current time, the current executing user and the current program name, print the green packaging success on the current screen, record the successful operation of the command in the log file, and continue to execute the next command;

[0023] If it fails, the failure function is entered to obtain the current time, the current executing user and the current program name, the current screen prints "Packaging Success" in red, records the failure of the command in the log file, and exits the program;

[0024] The step of continuing to execute the next command is to execute the above steps again from the beginning until there is no next command to be executed or the program is exited upon failure.

[0025] To achieve the above object, the present invention also provides a shell script printing log device, comprising:

[0026] Load module, used to load log function;

[0027] An acquisition module is used to acquire commands under the operating system;

[0028] An execution module, used for executing the command;

[0029] A judgment module is used to judge whether the command is executed successfully according to the log function in the shell script;

[0030] A recording module is used to record the success of the command in a log file according to the success function in the log function when the command is executed successfully, and the execution module continues to execute the next command; and when the command fails to be executed, record the failure of the command in the log file according to the failure function in the log function, and the execution module executes an exit program.

[0031] In one or more embodiments of the present invention, continuing to execute the next command includes the following steps: repeating the shell script log printing method until the program is exited or there is no next command to be executed.

[0032] In one or more embodiments of the present invention, the log file is a separate file independent of the shell script main program.

[0033] In one or more embodiments of the present invention, if the log function determines that the command is executed successfully, the current information of the command is obtained and the executed command is printed on the current screen with a green font color, and the current information of the successful command is recorded in the log file.

[0034] In one or more embodiments of the present invention, if the log function determines that the command execution fails, the current information of the command is obtained and the executed command is printed on the current screen with a red font color, and the current information of the failed command is recorded in the log file.

[0035] In one or more embodiments of the present invention, the current information includes the current time, the current executing user and the current program name.

[0036] In one or more embodiments of the present invention, the operating system is a Windows, Unix or Linux operating system.

[0037] To achieve the above objectives, the present invention also provides an electronic device, comprising: at least one processor; and a memory, wherein the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the method of printing logs by shell script as described above.

[0038] To achieve the above object, the present invention also provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the shell script log printing method as described above are implemented.

[0039] Compared with the prior art, the shell script log printing method according to the embodiment of the present invention can effectively reduce errors to a minimum by setting a failure function, and immediately exit the program when a certain step of the program command execution fails. In addition, by recording the real-time information such as time, execution user, program name, etc. during the shell program execution process into a specified log file, it can be avoided that some large projects cannot quickly and effectively query the log information due to too many files, and then the wrong command can be modified to simplify the operation process. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 It is a flowchart of a shell script log printing method according to an embodiment of the present invention;

[0042] Figure 2 is a flowchart of specific steps of executing a success function according to an embodiment of the present invention;

[0043] Figure 3 is a flowchart of specific steps of executing a failed function according to an embodiment of the present invention;

[0044] Figure 4 is a flow chart of a method for executing a log function according to an embodiment of the present invention;

[0045] Figure 5 It is the log record information after the command is successfully executed in one embodiment of the present invention;

[0046] Figure 6 It is the log record information after the command execution fails in one embodiment of the present invention;

[0047] Figure 7 It is a structural diagram of a shell script printing log device according to an embodiment of the present invention;

[0048] Figure 8 The hardware structure diagram of a computing device for printing logs using shell scripts according to an embodiment of the present invention.

[0049] Description of main reference numerals:

[0050] 501 Screen printing green packaging successful

[0051] 502 Command successful operation record

[0052] 601 Screen prints red package successfully

[0053] 602 Command failed operation record DETAILED DESCRIPTION

[0054] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific implementation modes.

[0055] Unless explicitly stated otherwise, throughout the specification and claims, the term “comprise” or variations such as “include” or “comprising”, etc., will be understood to include the stated elements or components but not to exclude other elements or components.

[0056] Implementation Method 1

[0057] like Figure 1-3 As shown, in this embodiment, it is necessary to implement such a logic to compress the list file in the data directory and move it to the tmp directory. It should be noted that the execution command is only for illustrative purposes, and the present invention is not limited to this. Any execution command that can implement the present invention is within the protection scope of the present invention, and the specific implementation steps are as follows:

[0058] In step S101, the log function in the shell script is loaded. The log function includes a log main function named fn_log, a success function named fn_info after successful execution, and a failure function named fn_error after failed execution. The names of the above functions can be defined by yourself and are not immutable.

[0059] In step S102, an execution command is obtained. In this embodiment, two commands need to be executed. The first command is to compress the list file in the data directory, and the second command is to move the compressed file to the tmp directory.

[0060] In step S103, the first command is executed to compress the list file in the data directory.

[0061] In step S104, the main function fn_log of the log function is executed.

[0062] In step S105, it is determined whether the first command is executed successfully. In this embodiment, the variable echo$? is used to determine whether the command is executed successfully, where $? represents the return value of the current command.

[0063] In step S106, if the return value is 0, it means that the command is executed successfully, and then the success function fn_info is executed. The success function fn_info is used to record the successful operation of the command in the log file. Next, the following command is executed: move the compressed file to the tmp directory, and loop through steps S103-S105.

[0064] In step S107, if the return value is non-zero, it indicates that the command execution fails, and then the failure function fn_error is executed. The failure function fn_error is used to record the failure operation of the command into a log file and exit the program.

[0065] In this embodiment, the operation record of successful execution recorded in the log file includes the time of successful execution (for example, recorded as: 2021-01-01 01:01:01), the executing user at that time, and the name of the program executed at that time. Similarly, the operation record of failed execution recorded in the log file also includes the same record information. When the execution of the first command is successful, the second command is automatically executed in a loop, which ensures the cyclicity without error. When the execution of the first command fails, after recording the corresponding information, the program is automatically terminated directly without continuing to execute the next command, so that the error can be reduced to a minimum. At this time, the engineer or operation and maintenance personnel can check the log file in time, compare the recorded unsuccessful operation information, and find the source of the error. At this time, the engineer can debug and correct the error target in a targeted manner and re-execute the technical solution of the present invention.

[0066] In this embodiment, the log file is a separate file independent of the shell script main program. When the number of files in some large projects is large, if you want to modify the command with execution error based on the log, the query process is cumbersome. This embodiment uses an independent log file to facilitate the query of the command execution time, execution user and program name.

[0067] Implementation Method 2

[0068] like Figure 4This embodiment provides a method for executing a log function involved in a shell script log printing method.

[0069] In order to better reflect the logic of the present invention, this implementation still takes the logic that needs to be executed in the first implementation as an example: the list file in the data directory is compressed and moved to the tmp directory.

[0070] In step S201, the log function is loaded and the log directory is obtained. The log function includes a log main function named fn_log, a success function named fn_info after successful execution, and a failure function named fn_error after failed execution. For example, the directory of the file is defined as / var / log / copy.

[0071] In step S202, the first command is obtained and executed - the list file in the data directory is compressed. At this time, a new file / var / log / copy / main.log is generated in the log directory to record program information.

[0072] In step S203, the return information of the execution command is obtained, and it is determined whether the result of the execution command is successful or not.

[0073] In step S204, if successful, enter the success function, obtain the current time, the current executing user and the current program name, and print the green packaging success 501 on the current screen. Figure 5 , record the successful operation of the command 502 to the log file, and record the log results as follows: At the time point 2021-04-15 17:25:42, the root user executed the main program with a log level of INFO, packaged tar-zcvf list.tar.gz / data / list successfully, and continued to execute the next command.

[0074] In step S205, if it fails, the failure function is entered to obtain the current time, the current executing user and the current program name, and the current screen prints red packaging success 601, such as Figure 6 , record the failed operation record 602 of the command to the log file, and the record result is as follows: At the time point 2021-04-15 17:30:41, the root user executed the main program with the log level of ERROR, the packaging of tar-zcvf list.tar.gz / data / list failed, and the program exited.

[0075] In step S206, when the first command is successfully executed and the second command is continued to be executed, the execution is still carried out according to steps S201-S205, except that the information of the execution result printed to the log will change with the change of the specific command information.

[0076] Implementation Method 3

[0077] When facing a large project, many files will be encountered. At this time, N commands need to be executed. During this execution process, there are multiple unsuccessful executions. If you stop to debug and correct an error, it will greatly affect the execution process of the entire project. Therefore, it can be chosen that after the entire project is executed, the programmer or operation and maintenance personnel need to handle the errors in a unified manner. At this time, the technical advantages of the present invention are clearly reflected.

[0078] This embodiment provides a shell script log printing method and a log function execution method. For example, the logic to be implemented in this embodiment is to compress the list files in N data directories and move them to tmp. The specific steps are as follows.

[0079] S301, loading the log function in the shell script, the log function includes a log main function named fn_log, a success function named fn_info after successful execution, and a failure function named fn_error after failed execution;

[0080] S302, execute the first command: compress the list file in the first data directory, and compress the first file;

[0081] S303, receiving the execution feedback result and determining whether it is successful;

[0082] S304, the execution is successful, and the information of the successful execution is recorded in the log file. The information of the successful execution includes the current time, the current executing user and the current program name, and the green packaging success is printed on the current screen;

[0083] S305, execute the second command: move the first compressed file to the tmp directory;

[0084] S306, receiving the execution feedback result and determining whether it is successful;

[0085] S307, the execution is successful, and the information of the successful execution is recorded in the log file. The information of the successful execution includes the current time, the current executing user and the current program name, and the green packaging success is printed on the current screen;

[0086] …

[0087] S311, executing the i-th (1<i<N) command to compress the i-th file;

[0088] S312, receiving the execution feedback result and determining whether it is successful;

[0089] S313, execution fails, and the execution failure information is recorded in the log file. The execution failure information includes the current time, the current executing user and the current program name, and the red packaging success is printed on the current screen, and the program is exited.

[0090] When you continue to execute commands for the remaining files, you need to restart the program and start execution from the next command. The specific process is as follows.

[0091] S321, restart the program, load the log function in the shell script, the log function includes a log main function named fn_log, a success function named fn_info after successful execution, and a failure function named fn_error after failed execution;

[0092] S322, execute the i+1th command to compress the i+1th file;

[0093] S323, receiving the execution feedback result and determining whether it is successful;

[0094] S324, the execution is successful, and the information of the successful execution is recorded in the log file. The information of the successful execution includes the current time, the current executing user and the current program name, and the green packaging success is printed on the current screen;

[0095] S325, execute the i+2th command to compress the i+2th file;

[0096] S326, receiving the execution feedback result and determining whether it is successful;

[0097] S327, execution fails, and the execution failure information is recorded in the log file. The execution failure information includes the current time, the current executing user and the current program name, and the red packaging success is printed on the current screen, and the program is exited.

[0098] …

[0099] Continue to execute the commands of the remaining files according to the above steps until all commands are executed. It is understandable that in the whole process, 2N commands are executed. If there are multiple unsuccessful executions, when programmers or operation and maintenance personnel query these errors, all error records can be quickly screened out through the red part in the log file (the unsuccessful execution information is recorded in red), and then the source of the error is quickly locked through the recorded log information (time, user name, program name), without debugging and troubleshooting one by one, which greatly improves the troubleshooting efficiency, and can quickly and effectively correct the errors and repair the files in time. In the present invention, under win, Linux and Unix environments, the variable $0 in the shell script represents the current program name, and the current program name is obtained by echoing $0.

[0100] The shell script log printing method provided by the present invention can effectively reduce errors to a minimum by setting a failure function, and immediately exit the program when a certain step of the program command execution fails. In addition, by recording the time, execution user, program name and other real-time information during the shell program execution process into a specified log file, it can be avoided that some large projects cannot quickly and effectively query log information due to too many files, and then the wrong command can be modified, simplifying the operation process.

[0101] In the above embodiment, the shell script log printing method is described in detail, and the present application also provides an embodiment corresponding to the shell script log printing device. It should be noted that the present application describes the embodiment of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.

[0102] Figure 7 The invention shows a device for printing logs by a shell script according to an embodiment of the present specification.

[0103] like Figure 7 As shown, the device for printing logs by shell scripts includes a loading module 701 , an acquisition module 702 , an execution module 703 , a judgment module 704 and a recording module 705 .

[0104] The loading module 701 is used to load the log function in the shell script.

[0105] The acquisition module 702 is used to acquire execution commands. In this embodiment, two commands are taken as an example. The first command is to compress the list file in the data directory, and the second command is to move the compressed file to the tmp directory.

[0106] The execution module 703 is used to execute commands.

[0107] The judgment module 704 is used to judge whether the command is executed successfully; in this embodiment, the variable echo$? is used to judge whether the command is executed successfully, where $? represents the return value of the current command. If the return value is 0, it means that the command is executed successfully, and then the success function fn_info is executed; if the return value is non-0, it means that the command fails to execute, and then the failure function fn_error is executed.

[0108] The recording module 705 is used to record the operation record of the command into the log file; the success function fn_info is used to record the successful operation record of the command into the log file, and the failure function fn_error is used to record the failed operation record of the command into the log file.

[0109] Figure 8 FIG. 8 shows a hardware structure diagram of a computing device 80 for printing logs using a shell script according to an embodiment of the present specification. Figure 8 As shown, the computing device 80 may include at least one processor 801, a memory 802 (e.g., a non-volatile memory), a memory 803, and a communication interface 804, and the at least one processor 801, the memory 802, the memory 803, and the communication interface 804 are connected together via a bus 805. The at least one processor 801 executes at least one computer-readable instruction stored or encoded in the memory 802.

[0110] It should be understood that the computer executable instructions stored in the memory 802, when executed, cause at least one processor 801 to perform the above combined operations in various embodiments of this specification. Figure 1-8 Describes the various operations and functions.

[0111] In the embodiments of the present specification, the computing device 80 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.

[0112] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-8 Specifically, a system or device equipped with a readable storage medium may be provided, on which a software program code implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system or device reads and executes the instructions stored in the readable storage medium.

[0113] According to the shell script log printing method of the embodiment of the present invention, the error can be effectively reduced to a minimum by setting the failure function, and the program can be exited immediately when a certain step of the program command execution fails. In addition, by recording the real-time information such as the time, execution user, program name, etc. during the shell program execution process into a specified log file, it can be avoided that some large projects cannot be quickly and effectively queried due to too many files, and then the wrong command can be modified to simplify the operation process.

[0114] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0115] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0116] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0117] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0118] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.

Claims

1. A shell script printing log method, It is characterized in that The steps include: Load the log function in the shell script; Get commands under the operating system; executing said command; Determine whether the command is executed successfully according to the log function in the shell script; If the command is executed successfully, the successful operation of the command is recorded in the log file according to the success function in the log function, and the shell script log printing method is repeated until the program is exited or there is no next command to be executed; as well as If the command fails to execute, the failure operation of the command is recorded in the log file according to the failure function in the log function, and the program is exited; The log file is a separate file independent of the shell script main program.

2. The shell script log printing method as claimed in claim 1, It is characterized in that If the log function determines that the command is executed successfully, the current information of the command is obtained and the executed command is printed on the current screen with a green font color, and the current information of the successful command is recorded in the log file.

3. The shell script log printing method as claimed in claim 1, It is characterized in that If the log function determines that the command execution fails, the current information of the command is obtained and the executed command is printed on the current screen with the font color being red, and the current information of the failed command is recorded in the log file.

4. The shell script log printing method as claimed in claim 2 or 3, It is characterized in that The current information includes the current time, the current executing user and the current program name.

5. A method for executing a log function, Features: The following steps are involved: Get the log directory; Execute the obtained command and generate a new file in the log directory to record the current program information; Get the return information of the execution command to determine whether the execution command is successful; If successful, enter the success function, obtain the current time, the current executing user and the current program name, print the green packaging success on the current screen, record the successful operation of the command in the log file, and continue to execute the next command; If it fails, the failure function is entered to obtain the current time, the current executing user and the current program name, the current screen prints "Packaging Success" in red, records the failure of the command in the log file, and exits the program; The step of continuing to execute the next command is to execute the above steps again from the beginning until there is no next command to be executed or the program is exited upon failure.

6. A shell script printing log device, It is characterized in that include: Loading module, used to load the log function in the shell script; An acquisition module is used to acquire commands under the operating system; An execution module, used for executing the command; A judgment module is used to judge whether the command is executed successfully according to the log function in the shell script; A recording module, used for recording the successful operation of the command to a log file according to the success function in the log function when the command is executed successfully, and the execution module repeats the shell script log printing method as claimed in claim 1 until the program is exited or there is no next command to be executed; And, when the command execution fails, the failure operation of the command is recorded in the log file according to the failure function in the log function, and the execution module executes the exit program; the log file is a separate file independent of the shell script main program.

7. An electronic device, It is characterized in that include: at least one processor; as well as A memory storing instructions, wherein when the instructions are executed by the at least one processor, the at least one processor executes the method for printing logs by a shell script as claimed in any one of claims 1 to 4.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the shell script log printing method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Command execution result acquisition method and computer readable storage medium

    CN111694616A