Several cases of sqlplus and shell passing value to each otherScenario One: The simplest invocation of sqlplus in the shell$cat test.sh#!/bin/shSqlplus Oracle/[email Protected]>file.log SELECT * from Test;ExitEOF #注意EOF要顶格写$sh test.sh$cat
grep command SyntaxThe grep command uses an option , a pattern to match , and a file to search , and its syntax is as follows:grep [Options] PATTERN [FILES]If no file name is provided, the grep command searches for standard input.
Options
1. Exit statusIn a Linux system, every time a command executes, the system returns an exit state, which is stored in the variable, which is an integer value that we can determine whether the command is running correctly.Typically, the exit status
When we write functional scripts, we tend to place functions that are similar in operation or similar in parameters into the same shell script, which is easy to manage, easy to maintain, and clear. In this case, the usual approach is to define all
ZZ: http://doc.linuxpk.com/80440.html
Sed (Stream Editor) usage:
1. It is a non-interactive text stream editor. It edits a file or copies the text exported from standard input.
2. Specify the text line to be changed using the row number or
Learning and using bash shell shortcuts
By fenng|It can be reproduced. During reprinting, it must be indicated by a hyperlink.ArticleSource and author information and copyright notice Web: http://www.dbanotes.net/techmemo/shell_shortcut.html
This
Shell scripts contain several Unix commands or executeProgram.
1. Run the shell script
There are two ways to run shell scripts. The first method is to use the sh command to take the shell script file name as a parameter. This method requires
While do done, until do done (indefinite loop)
In general, the most common status of an indefinite loop is the following two states:
While[Condition] The status in the brackets is the limit type.DoDoIt is the beginning of the
Use if... then
Single-layer, simple conditional
If [conditional statement]; then Command work content that can be executed when the conditional statement is set; FI
& Stands for and;
| Represents or;
["$ YN" = "Y"-
I originally wanted to write some shell scripts to train the trainer. I just wanted to give it a guess. so there will be a follow-up event. the most primitive guess script was first written. both functionality and aesthetics are unsatisfactory.
Preface:
Through studying spark cluster scripts, take notes on some important shell script skills.
*). Get the directory of the current script
sbin=`dirname "$0"` sbin=`cd "$sbin"; pwd`
Code comments:# The above code is a common technique for
#! /Bin/bash
# Returning an array value
Function arraydblr ()
{
Local origarray
Local newarray
Local Elements
Local I
Origarray = ('echo "[email protected]" ')
Newarrray = ('echo "[email protected]" ')
Elements = $ [$ #-1]
For (I = 0; I
{
Newarray
Recently, in the process of sorting out bash knowledge, I had the honor to read the man bash document. For a while, I was just like a hacker, and many places I didn't understand were suddenly open-minded. Now I want to share one of them, at the same
1. Execute bash shell:(1) Go to the directory where the shell script is located: CD/root/tmp and execute./test. Sh.
(2) execute shell script:/root/tmp/test. Sh in absolute path mode.
(3) run the script CD/root/tmp bash test. Sh, sh test. Sh, or bash/
Call another script in shell script
Bash shell commands are divided into two types: External commands and Internal commands. External commands are implemented through system calls or independent programs, such as SED and awk. Internal commands are
Blog has been migrated, new address
Bytes ----------------------------------------------------------------------------------------
In practice, you need to test the correctness of shell scripts.
How can we test in the fastest and most effective
One idea is to use awk to first create a conversion table between characters and ascii codes or numbers in the awin of awk, and then read the character table to be converted to output the corresponding conversion code. The following sample code
Access Parameters
You can use process. argv to access the command line parameters. It is an array containing the following content:
[NodeBinary, script, arg0, arg1,...]
That is to say, the first parameter starts from process. argv [2]. You can
Shell script execution error & #39; \ 357 \ 273 \ 277 & #39;: commandnotfound Solution
1. Delete the BOM and execute the following command under vi.
: Set nobomb
2. cause:
The so-called BOM is the Byte Order Mark, which is a Unicode character
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service