1. Receive the user's parameters:In order to give the user more flexibility to complete the work requirement, the shell script can pass parameters when executing the command: (command name parameter 1 parameter 2 ... )Shell pre-defined variables:$ $
Note: If you are the factory of children's shoes, write homework to find this article, I hope you do not copy ^_^, in fact, try to knock on your own will help you a lot.The title requirement is to student.txt the results of each stage of the
Suppose we define a variable as:Copy the Code code as follows:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:Copy the Code code as follows:${file#*/}: Delete the first/its left string:
A Linux shell script Shell: command-line interpreter(1) SH(2) CSH(3) Ksh(4) Bash Shell script: A collection of commands that accomplish a specific thing Two run a shell script file 1. Add executable permissions, and then run the./shell script file2.
1, the database is fully prepared to the hard disk[[Email protected] scripts]$ cat rman_backup.sh source /home/oracle/.bash_ profile rman target / log=/home/oracle/backup/backupall_rman.log2. Incremental backup ScriptLevel 0
1, the database is fully prepared to the hard disk[[Email protected] scripts]$ cat rman_backup.sh source /home/oracle/.bash_ profile rman target / log=/home/oracle/backup/backupall_rman.log2. Incremental backup ScriptLevel 0
I. Process Control statements1. If statement①IF Single branch: one condition one resultIf condition then command fi②IF Dual Branch: One condition two resultsIf condition then command Else command 2fi③IF Multi-Branch: Multiple conditions
Shell Test CommandThe test command in the shell is used to check if a condition is true, and it can be tested in three aspects of numeric, character, and file.
Numerical test
Parameters
Description
-eq
1. How shell scripts runCreate shell script files, usually ending with. SH (e.g. example.sh)The shell script works as follows:
Add ' x ' Execute permissions (relative or absolute path execution)
To invoke a script file using the bash or
The role of the shell is to parse the user's instructions and combine the shell instructions with a specific process to form a script.To view the current system Shell version:Once you have written a simple shell script, there are several ways to do
& Method:Unix/linux generally want to let a program run in the background, many use & at the end of the program to let the program run automatically.For example we want to run MySQL in the background:/usr/local/mysql/bin/mysqld_safe--user=mysql
Enterprise Practice question 1: (Production actual case): monitor MySQL master-slave synchronization is abnormal, if abnormal, send sms or mail to the administrator. Note: If there is no master-slave synchronization environment, you can use the
First, Shell introduction------------User|Terminal (equivalent to Bash's interface)|Shell (shell) bash most Linux systems default shell environment|KernelThe user enters the command through the terminal, submits it to the shell, and then invokes the
Write code--debug--fix bugChange to change there may still be some problems that are not found, when the project volume is more prone to occur, such as memory leaks such problems, serious impact on system performance.There are some tools on the
ENV View variable set also view variable content more powerful than env[[email protected] ~]# echo $HOSTNAME See the name of the variableBinbinlinux[Email protected] ~]# a=1;b=2[[email protected] ~]# echo $a $b can output a value of two variables0
Wrote a shell script on the Liunx, want to call this shell script through Java, do not know how to call, in the Internet said to use process this way, but my executive machine and my shell script is not the same computer, the boss said Java can
The cause of the bad interpreter:no such file or directory is an issue with the document format. This file was written under Windows. Line wrapping is not the same as UNIX, but under vim if it is not set a bit and it is completely invisible.Problem
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.