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
Shell Statistics Log InformationIn general applications, log information is logged using log4j and a log file is generated daily, with each file ending on the date of the day.How do I count and analyze these log messages?In the simplest cases, use
organized a few shell programming examples, for beginners! 1. InThe home directory creates 100 directories and the directory name is a1......a100. Instance 1 for((i=1; i -; i++)) Do mkdir "/home/a"$i DoneExample 2, you can also write a bit more
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;
The advantage of awk for sed grep is segmentation, dividing the delimiter into a small segment, matching, replacing, manipulating, logical judging, comparing ... such asBasic operations of AWK[[email protected] ~]# awk-f ': ' {print $} ' 1.txt////-F
Shell variables are divided into system variables and user-defined variablescommands to view variables#env System VariablesOr #set include env and custom variables and extra variablesThe command to use the variable is#echo $ "Variable"///////////////
In shell programming, "EOF" is usually used in conjunction with "
Interactive Program (command)
The content in the middle of "EOF" will be entered as a standard input to the "interactive program", when the shell sees
Reference documents:There are eight ways to intercept a string, mainly for the following methods650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>There are a number of ways to intercept strings in the
ShellThree ways to do it (not original, forget who's blog) 1: . Filename 1. SOURCE command usage: source FileNameFunction: Reads and executes the commands in the filename under the current bash environment. The filename file can have no "execute
Shell's advantage: You can call Linux system commands directlyBasic syntax for shell scripts:Script name ends with. shThe first action of the program #!/bin/bash, tell the system this is a shell scriptWith # as a commentHow shell scripts are
The result returned by the conditional expression is BooleanIt's 1, false is 0.Expressions for conditional tests[Expression][[Expression]]Test expressionCommonly used for:Monocular:-e file Test files exist-F file Test is a normal file-D File Test
Each time on-line, first put the intranet code with Xhell to local. Then drag it to the online server.Dragged and dragged, too slow. So I wrote an online script.Wrote a few versions, this is the final versionscp_v3.shThe contents are as
In the actual work, the shell script needs to be tested for correctness.How to test in the quickest and most effective way?A lot of development habits are, apart, write/Get, run a, see input, output, want to do the operation is completed, also
redirect$echo "Test Redirect" > Temp.txt--Writes the output to the Temp.txt,temp.txt file is first emptied.$echo "Test redirect Second" > Temp.txt-Append the output to the temp.txt.File descriptor0--stdin Standard Input1--stdout Standard
Shell Simple UnderstandingView the current SHELL echo $SHELLTry the first little script: Vim test.sh1 #!/bin/bash2 echo ' I'll be-back ';Note: #!/bin/bash This sentence is bound to add, remember. How to execute the script:1. Give execute permission,
1. REDIRECT standard output (stdout) and standard error output (STDERR) to two different files respectivelywhere the symbol ' > ' defaults to the standard output redirection, meaning and ' 1> ' the same, ' 2> ' indicates a redirect standard error
package.sh #!/bin/bashfor i in ' cat $ ' do echo $i >> resultdpkg-l | grep $i | Sed-n 1p > Tmp//awk read out all the data after the fifth column awk ' {for (i=5;i> result//the error content of the script Directed to a file in sudo dpkg--purge $i >>
0. Internal variables in the shell:1. $?: Represents the return value of the shell command.2. $$: Represents the PID of the current shell.3. $!: The last PID value to be put into the background job.4. $ A: Indicates the name of the script.5. $1--$9,$
Recently, follow the MIT operating system engineering Course (6.828/fall 2014) to write a simple operating system from scratch.Job 1 of the first lesson is to write a simple shell that can run the command and Support redirection (' > ', ' The source
I am not clever and understanding something are not quick. Even so,i can ' t be scared for facing it. Practice more and practice more. Don ' t stop your passion.
Recently to work on GitHub with small partners to do projects, my github ....
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