Shell script is a "program" written using the shell's function, which uses plain text files to write some shell syntax and instructions (including external instructions), with regular expressions, pipeline commands, and data flow redirection. In
Delete the first line in the file file1 to the line containing word characters and redirect to the file File2:Sed ' 1,/word/d ' file1 > File2Keep the lines in the file file1 that contain word characters and redirect to the file File2,-n to indicate
#!/bin/bash#author: The Adventures of Tintin (Jacob) #定义数组, save all the possibilities of Punch game= (stone scissors cloth) num=$[random%3]computer=${game[$num]}# Get the punch of a computer by random number # The possibility of a punch is
Shell scripts become used in the process usually requires process control, in general, sequential execution, in the actual use of different situations need to execute different commands, then use the choice to execute such as if, case, sometimes
In the work often encountered in a file to record a number of file name or picture name, in the specified directory to find all the files in this file, but the specified directory does not have all the names recorded in the file, you need to find in
The file name of the shell itself
$1~ $n Each parameter value added to the shell. $ $ is the 1th parameter, and the $ = is the 2nd parameter ...
$$ the shell itself PID (ProcessID)
$! PID of the Shell's last running background process
$? End
Shell Branch Statement Case inch mode 1) Command1 command2 command3 ; Mode 2) Command1 command2 command3 ;; *) Command1 command2 command3 ;; EsacDescription: After the case is taken, the value is the keyword in,
Method One: Set the terminal BACKSPACE to ASCII 127Method Two: Use CTRL + BACKSPACE keyPress CTRL + BACKSPACE key at the same time to delete.Method Three: Use Ctrl+w to send signals to delete entire wordsDirectly send the deletion of the whole word
Alias gives the command a nickname$ C= ' Clear 'CD changes the current path$ cd/etc Change the current path to/etc $ CD back home directory $ CD. Go back to the previous level directory $ CD-back to the directory you just went toCP Copy files or
Like the rigor of the thought logic of the first few linesThe logic is to learn the code creation is own#!/bin/bash#判断两个整数的大小Read-p "Please enter two integers a B:" A B#或者使用a =$1[-Z "$a"]| | [-Z "$b"]&&{echo "The number you entered is zero"Exit
Advantages: You can run the corresponding *.sh file in other folders, for example, through the putty will default into the folder, you can put the link file there, you can call directly!Method: Very simple1. Right click on the file to create the
Shell script loops over TV channel scripts#!/system/bin/shtime=$1if [[$time 0]]doecho ' run times $time "Input keyevent 166input keyevent 166input keyevent 167let" time--"Doneecho" Run End "fi Shell Script Switch TV channel
Transfer from http://blog.csdn.net/wangtaoking1/article/details/9838571 The main record is the concurrency and serial execution of commands in the shell script.By default, the commands in the shell script are executed serially, and must wait until
The importance of the shell is self-evident to every system adminstrator. Today Allah is here to talk about the acid and cool shell programming of those years.let's start with an entry-level programming example. By the way with the Dora of Allah's
in the recent completion of the teacher's assignments encountered how to let the shell script command automatically determine whether a user has set the password problem, although seemingly not a difficult problem, but in the process of
(1)Monitoring 80 Ports Write a script to determine whether the 80 port of the machine is open, if you do not do anything, if you find that the port does not exist, then restart the httpd service, the concurrent mail notify yourself. Once the script
Usually write scripts are not used in several groups, temporarily first record the usage.#!/bin/Basharray1=(1 2 3 4 5) Array1_length=${#array1 [@]}Echo "array1 Length: ${array1_length}" forIteminch${array1[@]} Do Echo "Current item of array1:
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