The so-called location parameter refers to the shell script command line parameter. In Shell functions, their colleagues can also be function parameters. Each parameter is named by an integer. For historical reasons, when it exceeds 9, it should be framed with braces:
Echo first Arg is$1Echo tenth Arg is$ {10}
In addition, through special variables, we can al
SHELL script-full explanation of tr command usage and features, shell script-tr usage
Directory:1.1 Introduction1.2 tr ing1.3 completely matched replacement1.4 compressed symbols1.5 Delete symbols and supplements
1.1 Introduction
Tr is mainly used to map the result set, compress the character, and delete the data read
Shell script -- cut command, shell script -- cut
Directory:1.1 option description1.2 filter by field1.3 Use -- complement1.4 split by byte or character1.5 Use -- output-delimiter1.6 specify the range in cut
1.1 option description
The cut command divides a row into multiple columns according to the specified delimiter.
Shell script-automatic DNS deployment and shell script dns
For details, see:
(1) Play with me the Linux Network Service: DNS service -- BIND (/etc/named. conf,/var/named) setting implementation and Explanation
1 #! /bin/bash 2 IP="10.10.10" 3 RIP="10.10.10" 4 DN="gr.org" 5 Name="10.10.10.10" 6 7 cat >> /etc/named.co
Shell script login template description, shell script Template
Write notepad and change the file suffix to sh
#! /Usr/bin/CT
# Log on to ssh
# Use the ssh server spawn in combination with Alibaba CT and send
Spawn ssh root @ ip
# Expectation
Reset CT "password :"
# Enter the password and click Enter \ n
Send "tktktktkt
Not long ago I saw two interesting commands in the book--script and Srciptreplay, which can record a terminal session in a file, that is, we can create a command-line video tutorial through a terminal session, or we can share session files with others, And the generated file is just a general text file, the size of the file is very small, it is very interesting. Here are two shell programs I've written to f
command:$WC-L You can also use here Document in a script, for example:
#!/bin/bash
Cat
A simple lookup program
For good (and bad) restaurants
In Cape town.
Eof
Operation Result:This was a simple lookup programfor good (and bad) Restaurantsin Cape town.The following script saves the document to the Test.txt file through the VI editor:
#!/bin/sh
File
Question:
1.Extract the rows that contain "warning" or "Fatal" and do not contain "ignor" from the. log file, and then extract the 5th fields separated ":".
2.Write a script and only want to perform simple subtraction. A prompt is required to enter the variable.
3. Read the shell script (explain the functions executed below). Pick out the errors in the following
This is to write to a friend of the script, is to do the CDN aspect, often meet the attack, but can not meet the attack on the domain name to block, we can have a choice to judge.
This is the PHP value Alexa is worth:
Copy Code code as follows:
$yuming = $argv [1];
Get Alaxe Rankings
function Getalexarank ($domain = www.jb51.net)
{
$line = "";
$data = "";
$url = "http://data.alexa.com/data/?cli=10dat=snbaver=7.0url=". $doma
line:
Copy Code code as follows:
[Root@ufo shellprogram]#./testexecutelog.sh 0 Msglog Execlog
In the above shell script, num1 corresponds to a value of 0 logfile in the command line with a value of Msglog execlogfile execlog.
The use of function setlogfile is setlogfile log file name, in the example using SetLogFile ${execlogfile}, in the function of exec 2>> $1;exec $ 1 redirects
[Shell script] searches for function difference sets implemented by shell scripts and shell scripts
Text address
Click follow public account wenyuqinghuai
Sharing outline:
1. Background
2. Code Implementation
1. Background
During the automated testing of the company's tests, some functions with code development are
(unset), then return to word, but do not change the value of var.
${var:=word}
If the variable var is empty or has been deleted (unset), return to Word and set the value of Var to word.
${var:?message}
If the variable var is empty or has been deleted (unset), then send message messages to the standard error output, which can be used to detect whether Var can be properly assigned.If this substitution appears in the she
of subscripts.Reading an arrayThe general format for reading array element values is:${array_name[index]}For example:
Valuen=${array_name[2]}
As an example:
#!/bin/sh
NAME [0]= "Zara"
name[1 ]= "Qadir"
name[2]=" Mahnaz "
name[3]= "Ayan"
name[ 4]= "Daisy"
echo "first Index: ${name[0]}"
echo "Second Index: ${name[1]}"
Run script, Output:$./test.shfirs
1. Linux Scripting Basics
1.1 Basic Introduction to grammar
1.1.1 Start
The program must start with the following line (must be on the first line of the file):
#!/bin/sh
The symbolic #! is used to tell the system that the parameters behind it are the programs used to execute the file. In this example we use/BIN/SH to execute the program.
When you edit a good script, you must also make it executable if you want to execute the
What is the Q:1 shell script and is it required?
A: A shell script is a text file that contains one or more commands. As a system administrator, we often need to use multiple commands to complete a task, and we can add all of these commands in a text file (shell
Shell learning notes, shell script Learning Guide
It's all a bit of fragmented knowledge. What do you need to write!
1. shell Script Parameters
C uses (int * argc, char * argv []) to process parameters, python sys. argv [0] (Script
The Linux/unix shell script, such as calling or executing Sql,rman, provides great convenience for automated jobs and multiple iterations, so Oracle is completed through the Linux/unix shellAnd is one of the essential skills of DBAs. This article calls SQL for the Linux/unix shell script, and the Rman
Linux shell programming 1 ---- shell script programming basics 1 What is shell script 1 shell is not only a command interpreter but also a programming language, a program written in shell
Shell programming in the 2nd Chapter of Shell script Getting Started1. What is the shell?The shell is a command interpreter that interprets commands and programs that execute user input, is responsible for direct conversations with the user, interprets the user's input to th
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.