Tags: scripting shell OracleCopy the daily EXPDP export file of an Oracle database to a remote server using shell scriptingZhao Full Text Network name: GuestartWe have a production environment Oracle database, although the daily Rman backup, but also overwhelmed by the developer go out said to restore a few days before the table data into the production environme
process control blocks are recycled and the resources are recycled. Such as:
The process is dynamic.Here is the concept of programming language: The programming language is divided into high-level and low-level language, the language is not to say that the higher the better, low-level means that the closer to the bottom, the higher the higher the closer the human natural language, lower-level language execution efficiency will be relatively high. Such as
As we can see,
Previous section Review In the previous blog post, I focused on the background of Shell scripting, how to create the first shell script in life, and the shell variables. The next step is to introduce shell programming, mainly around she
addition to Shebang, the # occupies the absolute beginning of the content, is the comment line, the interpreter ignores the contents of such a line;3. The explanation ignores all blank lines in the script;4. Lots of commands and keywords (if,else,then,do,while,for, ... )Note: Once the shell script runs in the current shell according to Shebang's instructions, an interpreter (child
command. You can use Echo to print any variable value in any place where you suspect it is wrong. That's why most shell programmers spend 80% of their time debugging programs. of the Shell programThe advantage is that there is no need to recompile, and it does not take much time to insert an echo command.The shell also has a real debug mode. If there is an error
overwritten.Syntax for input redirection: directives Example: For example, we have a file Test.txt with 3 lines of content. We want to count his number of rows, which can be counted by executing commands: Wc-l Result output: 3Well, through the content of section four, we have mastered the basic use of the shell, can write some simple shell program, but there is a gap between the real coding, so we have to
Security code: Waves will sometimes, straight hanging cloud sail sea Shell scripting App (iii)Foreword: It is difficult to write all the code in sequential order when it is hard to satisfy the requirements when facing various lists and repeating tasks. Use other program control structures such as loops, branches, and more to make it easier to perform more complex and powerful functions.1. Use a For Loop sta
, The interpreter (interpreter) needs to read the source code that we wrote and convert it to the target (object), which is then run by the computer. Because each execution of the program is more than the compilation process, so efficiency has decreased.The advantage of using scripting languages is that they are mostly run at a higher level than the compiled language and can easily handle objects such as files and directories, and the disadvantage is
the default format for shell scripts written in Windows systems is DOS instead of UNIX, resulting in incorrect output results.Look at the format of the shell script and edit the shell script with VI. Then enter ": Set FF?" If the output end is "Fileformat=dos", you need to modify the format of the file// modify file format, open
enter a variable value to the variable name at the keyboardIf you read+ multiple variable names, separate the values of the input variables with a space.More useful Commands read-p "Please input xxxxx:" + variable nameThe scope of the The export variable name can declare a variable as a global variable (this variable can be used in a child shell)be able to export XX = xxx at the time of definitionUse the unset variable name to eliminateOperation of C
specified shell command
V
Start the VI editor with the current file
.
Repeat the previous command
N
Find in file the overflow matches the content of the specified expression
‘
Jumps to the first content that the specified expression matches to
Ctrl+l
Redraw the current scre
]
Then
Echo "A is greater than B"
Elif [ $a -lt $b ]
Then
Echo "A is less than B"
Else
echo "None of the condition met"
Fi
Operation Result:A is less than BThe IF ... else statement can also be written as a line and run as a command, like this:
If test $[2*3] -eq $[1+5]; Then echo ' The numbers is equal! ' ; fi;
The IF ... Else statement is also often used in conjunction with the Test command, as follows:
NUM1=$[2*3]
num2=$[1+5]
results of "mail.jpg tux.jpg".quotation marks (single and double quotation marks) prevent this wildcard extension:
#!/bin/shecho "*.jpg" Echo ' *.jpg '
This will print "*.jpg" two times.Single quotes are more restrictive. It prevents any variable expansion. Double quotes prevent wildcard expansion but allow variable expansion.
#!/bin/shecho $SHELLecho "$SHELL" Echo ' $SHELL '
The result of the operation is
.2) read uses the IFS character to parse the text, and here we specify the IFS as a comma.Cat >> $outfile This includes an output append redirect (>>) and an input append redirect (>> appends the output of the cat command to the file specified by the $outfile variable.The input to the Cat command is not taken from standard input, but is redirected to the data stored in the script.The EOF symbol marks the beginning and end of the data appended to the file.Input file + run + Result:DescriptionSpe
, The interpreter (interpreter) needs to read the source code that we wrote and convert it to the target (object), which is then run by the computer. Because each execution of the program is more than the compilation process, so efficiency has decreased.The advantage of using scripting languages is that they are mostly run at a higher level than the compiled language and can easily handle objects such as files and directories, and the disadvantage is
the exponentiation is ^ implementation arithmetic: (1) Let var= arithmetic expression (2) var=$[arithmetic expression] (3) VA r=$ (arithmetic expression)) (4) var=$ (expr arg1 arg2 arg3 ...) when multiplying to translate *, i.e. \* (5) declare–i var = value (6) echo ' Arithmetic expression ' | BcPractice:1. Write script/root/bin/sumid.sh, calculate the sum of the 10th user and 20th user ID in the/etc/passwd file [[email protected] bin] #vim sumid.sh #!/bin/bash u10= ' CA T-n/etc/passwd |grep
[Turn]http://www.knktc.com/2011/08/20/linux-shell-expect%e6%89%b9%e9%87%8fscp%e8%84%9a%e6%9c%ac%e5%b7%a5%e5%85%b7/
One of the most recent tasks in preparing a deployment is to send some files, such as installation packages, to a large number of servers. Although there is already a Brother Woo script available: A Python script written by the SSH and SCP features provided by the Paramiko module. But I'm still in the fear of Python (though I've worked m
Sch Help Shell Scripting Encryption Geneva I. Span style= "Word-wrap:break-word; Font-weight:normal; font-size:7pt; Font-family: ' Times New Roman ' ">NBSP;NBSP; introduction SHC (shell script compiler) shell script compiler. by SHC Compiled scripts are unreadable to ordinary users, so if you want your c
by default.The list of REDIRECT commands is as follows:
Command
Description
Command > File
Redirects the output to file.
Command
Redirects the input to file.
Command >> file
Redirects the output to file in an append manner.
n > File
redirect files with file descriptor N to file.
n >> File
Files with file descriptor n are redirected to file in an append manner.
Scripting programming languages and compiled languages:
Scripting programming Language: (Bash)
The scripting language is usually interpreted (interpreted), which is read into the program code primarily by the interpreter (interpreter) and is translated into an internal form for execution.
Advantages:
can easily handle objects such as files and directories.
D
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.