1. Requirements
Reed is a system administrator who needs to add a teacher and several student users to a server in a classroom, manually adding too much trouble, and ask you to write a bash script for him userctr.sh implement bulk add and
This is the case with the switch as an example of the script written, other manufacturers of equipment according to the device command to modify the script.DemandBulk Backup network device profile to FTP server, and automatically compress the
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
about the futureAnd is she really human?She ' s just so something newA Waking Lithium flower --"Lithium Flower" in The depicted by Ghost in the Shell, mankind and machinery is combined. Cyborg, refers to the human organ that
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,
1. Write the Hello World script#!/bin/bashecho "Hello World"2. Create a Linux system account and password with location variables#!/bin/bash#$1 is the first parameter to execute a script, and the second argument to execute the scriptUseradd "$!"echo
***大家好,我是霸王卸甲,又到了今天更新文章的时间了,今天给大家带来的是第一章中的第二小节 shell语言!!***
GNU Bash Introduction: The shell is the user interface of the system and provides an interface for users to interoperate with the kernel.It receives the command entered by the user
First Category: Digital cycle-----------------------------for1-1.sh#!/bin/bash for ((i=1; i; i++)); do Echo $ (expr31); Done -----------------------------for1-2.sh#!/bin/bash for with $ (seq1) do Echo $ (expr31); Done --------
#!/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
Mathematical calculations in the shellOne, use square brackets#!/bin/Basha=tenb=c=res=$[$a * ($c-$b)] Echo $resIi. usage of BCBC Technology is actually a programming language that recognizes: numbers (integers and floating-point numbers)
Get seven Method 1 of string length. \${#str}Length of 2.awkNote:1) It is best to use {} to place the variable2) You can also use length ($) to count the lengths of each line in the file3.awk NFNote:-F is a delimiter, NF is the number of fields,
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
Format: echo "/033[word background color; font color m string/033[control code"If you simply display the font color can be fixed control code bit 0m.Format: echo "/033[word background color; font Color m string/033[0m"Word background color range: 40-
Shell Scriptdking~ sharing1.1 Scripting ConceptsPut multiple commands into a single file to facilitate one-time execution of a program fileUnified Script Storage Directory:/server/scriptsUsing Vim to edit scripts is recommendedTo view the script
Shell script is similar to batch processing under Windows/dos, that is, the use of various commands pre-placed into a file, convenient one-time execution of a program file, mainly for the convenience of administrator settings or management. However,
1. Receive the user's parameters:In order to give the user more flexibility to complete the work requirement, the shell script can pass parameters when executing the command: (command name parameter 1 parameter 2 ... )Shell pre-defined variables:$ $
Shell script login template description, shell script Template
Write notepad and change the file suffix to sh
#! /Usr/bin/CT
# Log on to ssh
# Use the ssh server spawn in combination with Alibaba CT and send
Spawn ssh root @ ip
# Expectation
Reset
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
Use of the special variable IFS in shell, and the difference between the value of $ '\ n' and' \ n', shellifs
When a for loop is used in shell, the IFS is also used to define the separator. To specify multiple IFS characters, you only need to
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