$# is the number of arguments passed to the script. The name of the script itself is the first parameter passed to the shell script , and the second argument is passed to the shell script [email protect Ed] is a list of all parameters passed to the
Typically, we enter commands from the command line each time to get a response from the system. This is obviously inefficient when we need to enter commands one after the other and finally get the results. To achieve this, we usually use shell
Break, continue, exit, return are generally used to control the direction of the loopStart with a script descriptionFor ((i=1;iDoIf [$i-eq 3]Then# break# continue# exitFiEcho $iDoneEcho OKResults of the outputResult of break12OkResults of continue124
Article Source: (Linux Shell) The first chapter--Small trial sledgehammer (next)1.6 Arrays and associative arrays1.6.1 Preparation KnowledgeBash supports both normal and associative arrays, and normal arrays can use integers only as an array index,
Source: (Linux Shell) Chapter One--Small trial sledgehammer (i.)Starting today, let's study the book "Linux Shell Scripting Raiders".1.1 IntroductionA shell script is usually a text file that starts with #!, as follows:#!/bin/bashThere are two ways
The second of Shell programming learningFirst, Bash's condition testTest method, or test writing:Test EXPR[EXPR][[EXPR]]For example: Test whether the variable user_name is rootTest $User _name= "root"[$User _name = = "Root"][[$User _name = =
Shell script error: "[: =: unary operator expected"Md5_109a = "81ab961153b62d207f0f517048881b5d"Md5_1_ B = 'md5sum install. Bin | awk '{print $1 }''If [$ md5_109a! = $ Md5_1_ B]Cause: when the file install. Bin does not exist, $ md5_1_ B is empty so
#! /Bin/bash# Initializing Environment VariablesSource. bash_profile# Inherent date format in log nameF_name = 'date + % Y % m % d'# Log path and nameLOG_FILE =/backup/DB/RMAN/log/RMAN $ f_name-0401.logEcho $ LOG_FILE# Counting the number of log
Recently, some tests were conducted in Erlang shell. In order to make the test result data more intuitive, we wanted to align the data to be printed and achieve the same effect as imaging tables.
The idea was to insert a tab in the data. Of course,
#!/bin/bash## Judging the element is a file or a folderif [ $# -lt 1 ];then echo "ERROE!! Usage: ckfile.sh ARGS1 [ARGS2...]" exit 4fifor i in `seq 1 $#`doif [ -f $1 ];then echo $1 is a commom fileelif [ -d $1 ];then echo $1 is a directoryelse ec
This article is based on the "Unix/Linux Programming Practice tutorial". This is a book that explains programming for Unix systems. It focuses on practice and is difficult to understand. We recommend that you read this article, there will be a
The columns in the text line are broken:
Awk 'in in {srand ()} {for (I = 1; I
The lines in the text line are broken down:
Awk 'in in {srand ()} {B [rand () Nr] = $0} end {for (X in B) print B [x]} 'Data
Shuf-n1000 data
Use a.txtas the patternto
Bbb board Lesson 5: shell script programming Experiment
In Class 1, we test and control the high/low output of the gpio port through simple echo commands to enable and disable the control of an LED indicator. This section uses shell script
[From] http://blog.chinaunix.net/uid-168249-id-2860686.html
Reference: 1. system environment variables after a user logs on to the system:$ Home user's own directory$ Path: the directory to be searched during Command Execution$ TZ Time Zone$
1 shell variable BasicsShell variables are very "weak" variables. By default, a variable stores a string, and shell does not care about the meaning of the string. Therefore, to perform mathematical operations, you must use commands such as let,
1. first introduce the usage of Alias (alias)
Alias LA = 'LS-a' alias B = 'CD... 'and so on
Alias is a good thing. It can save a lot of time when using shell.
2. But one day I found that the if statement cannot be used when executing the shell
An example of a Shell with parameters and a shell parameter
#! /Bin/bash # Program: # LZSH server log filter # History: #2014/07/01 Kom First release #2014/07/03 Kom Remote and multi-param support # Set PATHPATH =/bin:/sbin:
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.