Shell script entry, shell script
There are two ways to use Shell script:
① Interactive: each time a user inputs a command, the Shell immediately executes the command;
② Batch: You can c
Label: blog file SP Div Problem C on log Linux
Category:
You can execute another shell script (or non-executable file, mainly used to obtain the value of some variables) in one shell script :. file name (including path) or variable = file name (including path ). $ variable Note: there is a space behind the dot. In th
1. When the shell script executes the Python script, you need to use the return value of the Python script to determine the command to be executed by the following program
Example: There are two py programs hello.py
Copy Code code as follows:
def main ():
Print "Hello"
If __name__== ' __main__ '
SHELL: Write NGINX Service Control script, shell: Write nginx script
Nginx installed in the source code package cannot use "service nginx start" or "/etc/init. d/nginx start" for operations and control. Therefore, the following service control script is written.
You can use
In Java,python, you can use the import method to make calls between scripts or modules, for example:
Copy Code code as follows:
>>> Import Math
>>> Math.sqrt (4)
2.0
How do you invoke other shell scripts in the shell, or variables in other scripts, functions?
Method one:. ./subscript.shMethod Two: source./subscript.sh
Attention:
1. Between two points, there are spaces, you mu
Shell script sum (Code instance), shell script sum instance
The principle is as follows:
1) define two variables I, sum, both initialized to 0 2) define a loop body, calculate the sum. 3) Use let $ sum = $ sum + $ I to replace the value. 3) sum of the final output and the sum she
First, the shell script writing and testingGoal:This example requires two simple shell scripts, with the following task objectives:1> wrote a greeting/root/helloworld.sh script that was executed and displayed a phrase "Hello world!! ”2> Write a/root/sysinfo script that can o
First, Shell introduction
The design of many Unix-like operating systems is stunning. Even today, the UNIX-style operating system architecture remains one of the best designs ever. One of the most important features of this architecture is the command line interface or shell. The shell environment allows users to interact with the core functions of the operating
Project release, write a shell script to start the project, including the start of the project, turn off the restart, including the project log output to the specified file, not for anything else, just for the next project release, you can directly copy the past use of the script. Ha ha..
Copy this shell
Shell script structure Example 1, shell script example
Since 2013, I have been lazy and have written a lot less. This year, I plan to summarize my previous accumulated experience.
Start with shell.
After nearly three years of game O M, I often write some
SHELL script -- read command, shell script -- read
To interact with Linux, it is essential for the script to obtain the keyboard input results. read can read the keyboard input characters.
read [-rs] [-a ARRAY] [-d delim] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [var
Shell script, simple powerful, shell scriptThis is a Shell that you may not know. It is taken from the Linus and Linux journal added by codenon. After reading this book recently, I think there is a lot of good content. This is one of the Shell desserts. I will share it with
Shell script programming (strict terminal format control, beautiful output font color), shell script Programming
#! /Bin/bash # font output color and terminal format control # font color 30-37echo-e "\ 033 [30 m black character \ 033 [0 m" echo-e "\ 033 [31 m red word \ 033 [0 m "echo-e" \ 033 [32 m green word \ 033 [0
Script A (test example 1)
Copy Code code as follows:
#!/bin/bash
Echo ' Your are in the '
Q) Call another script file in the current script file?
Method One: Using sourceScript second (test example 2)
Copy Code code as follows:
#!/bin/bash
Echo ' Your are in second file '
SOURCE A
Method Two: use.
Simple shell-script example and shell-script example
#! /Bin/bash # defind the pathPATH =/usr/localexport PATHread-p "please input your first name:" firstnamereap-p "please input your last name: "lastnameecho-e" \ nyour name is: $ firstname $ lastname "# use date create fileread-p" please input your filename: "fileuser
First, debug scripts
Debugging is one of the important features that every programming language should implement, and when something unexpected happens, use it to generate the running information of the script, and the debugging information can help you figure out what caused the program to crash or behave abnormally.Second, bash built-in debugging function
With the built-in debugging capabilities of bash, you can debug the entire
a few days ago, the seven-ox demo, written with Bash, is a handy script to install, involving path-related judgments, from StackOverflow, plus your own practice. The simple version below is one of the simplest implementations that can solve most of the problems that are shown for soft links is the directory where the soft links are located Lineos:falseCopy the code code as follows: #!/bin/Bashdir="$ (CD"$ (dirname" $")" pwd)"This version of the perfec
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.