Standard input and output
Three standard files are usually opened automatically when executing a shell command lineThe standard input file (stdin), which usually corresponds to the terminal's keyboard, the standard output file (stdout), and
Break:Berak statements are usually used in loop statements and switch statements, and when the break statement is used in a do-while, for, and while Loop statement, the program terminates the statement following the loop. Usually the break
1. String length:Var=123abc456echo ${#var}9expr length $var 92. Specify character interceptionEcho ${var:5} #截取前五个字符c456echo ${var:2:5} #截取第2到第5个字符3abc4echo ${var: 3} 3 characters after intercept (with space on the left) 4563. Interception of
First, the purposeWrite a script to get the size of all the files and folders in the specified directory. The style of the output isLS-LHcommand is the same.Command execution example, where andLS-LHThe only difference in command output is the size
1. Batch Add UsersCreate a TXT file for the user name and password combination userdata.txt, as follows:123123 123 123 123 123The script to add the above users in bulk is:#! /bin/Bash whileRead Line Dousername=$(Echo$line |Cut-f1-d' ') #或 username=
11. Scripting, man-machine Games#!/bin/bash#Author: The Adventures of Tintin (Jacob)Game= (Stone scissors cloth)NUM=$[RANDOM%3]computer=${game[$num]}#通过随机数获取计算机的出拳#出拳的可能性保存在一个数组中, game[0],game[1],game[2] are different possibilities in 3,
There are three standard input and output in Linux, namely Stdin,stdout,stderr, the corresponding number is 0,1,2.STDIN is a standard input that reads information from the keyboard by default;STDOUT is the standard output, by default output output
#!/bin/bashset-ecommand 1command 2...exit 0---------------------------------------------------------- every script you write Should include Set-e at the top. This tells bash, it should exit the script if any statement returns a non-true return
1.shell condition judgmentCommand: Test or [Use "[" to End With "]" and a space between judgment statementssuch as: Determine if the demo.c file existsIf [-F DEMO.C]Then...FiOrIf Test–f demo.cThen...Fi1.1 String Comparisonsstring1 = string2 Same as
Shift parameter moves left oneSHIFT + number, the parameter moves to the left n bits at a timeIt can be used to determine the number of parameters behind the program.Returns an error when the shift value is emptyUse read to assign input values to
Environment:Kali system, Windows systemProcess:In the Kali system generated by the use of files, Kali system listening to the local port, Windows system open DOC file, you can recruit The first method of use, suitable for testing:Download code from
Python2:To open a terminal, enter the following command:[Email protected]:~$ vim helloa.pyIn the Vim editor, enter edit mode (press i), enter the following code, and then exit edit mode (press ESC), save the file (press shift+ semicolon, and then
01. Environment variable = + user-defined variables take effect only in the current shell, and environment variables take effect in the current shell and all child shells of the shell.If you write the environment variable to the appropriate
Starting with this blog, we'll go into the Linux shell Script learning, which is particularly important for Linux learning enthusiasts and a particularly interesting section, as well as the shell script, like the java,php-like programming language
8.6 Pipe break and job control:1, cat 1.txt |wc-l; Cat 1.txt |grep ' aaa '2. Ctrl Z pauses a task3. Jobs View background tasks4, Bg[id] The task to the backstage5. Fg[id] Transfer the task to the front desk6. Add & Drop the command back to the
The Linux Shell "(())" Double parenthesis operator uses theAt the beginning of learning Inux shell scripting, for its arithmetic and logical operations. It is estimated that many friends feel more difficult to accept. When using the special variable
Two virtual machines, all to be detected1. is yum available2. Firewall default zone modified to trusted3. Whether the IP address is configured#######################################################Second, ordinary users (must restore the environment)
Through the combination of jenkins and shell scripts, the war package is automatically deployed on multiple servers.
Combined with shell scripts, jenkins can automatically deploy war packages on multiple servers.
Environment:
192.168.2.120 jenkins
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.