[Linux] Shell Scripts

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

Shell: Delete/Preserve a specified line in a file

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

Shell script game: scissors stone Cloth

#!/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 Script Process Control

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

The shell script records the files that are not stored

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

Common shell commands

Tag: grep hex BSP df-h color directory encountered sort1. Find the contents of the file (e.g. account number: zh123456): Grep;lsMode 1 Find all Files: grep zh123456 *Mode 2 recursive lookup: ls | Xargs grep zh123456Mode 3 Recursive lookup: Find.

Common shell variables

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

Linux Shell Learning Four

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,

HBase Notes Remote Shell Interface command line cannot remove character solution

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

Commands commonly used by the shell

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

Fully automated deployment of the shell scripts PXE

#!/bin/bash#2017 -07-21 by Max#config PXE#config Yumif [!-D ~/yum.bak];Thenmv/etc/yum.repos.d/* ~/yum.bakElsemkdir ~/yum.bakmv/etc/yum.repos.d/* ~/yum.bakFiCat

Shell Two integer judgment size thought version

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

"265" Shell file creation link

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 Switch TV channel

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

concurrency in shell scripts

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

Shell definition variable Pits

Debugdir="/debugexamples "Releasedir="/releaseexamples "Docdir="../../../Mew_devdata/Interfacedoc/" forPathinch' ls ' doifTest-d $path ThenEcho'Test Package'$path cd $path./test.sh CD. RM-r $docDir $path$debugdir RM-R $docDir $path$releasedir CP-r

The play says Shell programming

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

Automatically determine whether a user has a password in a shell script

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

Shell Exercises (2)

(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

Shell script (v) array

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:

Total Pages: 541 1 .... 408 409 410 411 412 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.