Positional parameters can be shift shifted left with the command. For example, the shift 3 original $4 now become $1 , the original $5 now become and $2 so on, the original $1 , $2 $3 Discard, $0 do not move. Commands with no parameters are shift
The use of SEQ in the shellExample:/bugzilla/group.00....group.99 more than 3 years of data mv to/history/bugzilla/group.00...group.99Seq-w (-w = 0 in front to make the same width)#!/bin/bashFor Inum in ' seq-w 00 99 'DoSsdir=/bugzilla/group.
Demand
Sometimes in the shell script needs some execution, if placed in the program is not easy to unified management, and every time you modify the path to the script inside to change the trouble, so the unified path in the configuration file
1. Location of shell configuration files
The most commonly used shells are SH and bash, which only speak sh and bash here.
1.1. SH (Bourne Shell) configuration file has two main, respectively, each user home directory
Format: echo-e "\033[word background color; font Color m string \033[0m"For example:Echo-e "\033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the color of the wordThose ASCII code is the
Shell scripts are usually text files that start with #!/bin/bash. #! is placed before the interpreter path.Use bash as the interpreter to interpret all command-line commands.There are two ways to run a script, one is to use the script as a
Positional variables:$: Gets the file name of the current execution shell, including the script path if the script is executed with a path $n: Gets the n=1..9 parameter value of the currently executing shell script, which represents the file
In Linux there are many ways to read a file row by line, the most common is the method in the following script, and is the most efficient, most used method. In order to give you an intuitive feeling, we will test the execution efficiency of various
Add users in bulk and set a random password to save the added user's name and password to a file.[Email protected] scripts]#CatUser.SH #!/bin/SH forIinch`seq-W Ten` DoPass=$(Echo "' Date ' $RANDOM"|md5sum|Cut-C1-8) //Take the random number method is
Early computers because you understand the reason there are multiple physical terminals (by connecting the port of the computer what to achieve), here the terminal is the I/O device. The computer itself, which is inherently an I/O device (not an
Sometimes we need to overwrite a folder to our working directory, but need to automatically back up the existing files, one to go back to the backup is too troublesome, all the backup is not necessary. Shell scripts can do a good job of doing this.
Use digital code to color your fonts in Linux
Font color code: Reset 0 , black, red, green, yellow, blue, magenta , Cyan, light grey Panax Notoginseng
Effect code:1m bold 2m plus underline 5m flashing effect 7m plus background color
Chapter One: Shell Start-up basics1. Variables: In bash, the value of each variable is a string. Whenever you assign a value to a variable, there is no quotation mark, and the value is stored as a string.2, Var=value; Assignment operationvar = value;
String:1. Single quotes:str = ' value 'Single-Quote String restrictions:Any character in a single quotation mark is output as is, and the variable in the single-quote string is not valid;Single quotation marks cannot appear in single quote strings
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