Write shell scripts Common sh test.shThe notation of-M 2-d 3Case script:#!/bin/bashwhile getopts ": a:b:c:" Arg #选项后面的冒号表示该选项需要参数doecho "arg": $arg case $arg in a) echo "a ' s ARG: $OPTARG---$OPTIND "#参数存在 $OPTARG
The landlord encountered a scene like this:Execute a script locally, log on to the server, but the login server requires a password to implement the password manually in the scriptThe function of EOF can be achieved by:ssh [Email protected] 192.168.
Shell script Detailed definitionA "program" written using the shell's function, which is a plain text file, can write some shell syntax and commands (including external commands) in it, with regular expressions, pipe commands, and data flow
1. Create Shell script:/home/test.shcd/home/Vim tesh.sh #linux不区分后缀,. SH is only for user convenience;The first line of the test.sh file defines the format: #!/bin/bash indicates that the file is executed with the bash shell;Content to write
#!/bin/bash#filename:ifs. SH Data="name,sex,rollon,location"oldifs=$IFSIFS= for inch $data; do Echo Item: $item Done #IFS= $oldIFSSet IFS to, number separator#!/bin/Bash#filename:fenge.SH Line="Root:x:0:0:root:/root:bin/bash"oldifs=$IFSIFS=":"
[Email protected] ~]# history # View command history, command history exists in ~/.bash_history file ~]# !! # Indicates the execution of the previous command ~]# ls!$ # represents the last parameter of the previous command ~]#!950
grep: For fuzzy lookups, in standard input or file Format: grep [option parameter] ... PATTERN | FILE ...Option parameter Description:- E,--extended-regexp PATTERN is an extensible regular expression-E,--regexp=pattern using PATTERN for matching
Shell scripts can be directly./**.sh, or bash **.shI use the./**.sh to run a script of my own, and the following error will appear:[Email protected]:~$./pixel. SH bash:. /pixel. SH : Insufficient permissions [email protected]: sudo ./pixel. SH
You want to use a shell script to convert all the images in a folder to a pixel.Here are some of the wrong places:1. When defining a variable, the variable name does not add a dollar sign ($), such as: VariableName="value" Note that there can be no
From Wang Yin: the flaw of UnixI would like to explain my understanding of the nature of Unix philosophy through this article. While I point out a design problem with UNIX, the goal is not to attack the interest of UNIX. Although Unix has a very
Getting Started with Shell programmingOne, variable assignment and arithmetic operationDemo Sample code:A=1echo $alet b= $a +1echo $bc =$[a+b]echo $cd =$[c*2]echo $dlet e=d*2echo $ef =$[e%5]echo $fNote the "=" number must not have spaces on either
Guide
In Linux, shell commands are efficient at running concurrent processing tasks, and shell scripts are not tedious, not only for the magic sound but also for the shell's color display. Now we'll use the color in the shell to improve the
First, what is the shellThe shell typically represents two levels of meaning, one is the command interpreter, such as bash, and the other is the shell script. In this section we stand on the command interpreter's point of view to illustrate the
Alias creating aliasesUnalias Deleting aliasestype [name] to see if it is an internal or external commandenv lists all environment variables and their contents in the current shell environmentset to observe all variables in the current shell
Multiple values can be stored in an array. The Bash Shell supports only one-dimensional arrays (which do not support multidimensional arrays) and does not need to define the array size when initializing (similar to PHP).Like most programming
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