Shell Script Process Control

4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)

Basic Bash Shell command--3

Environment variables in the shell become global variables and local variables. Global variables take all caps.1.printenvView the global variables for the system.Displays the value of a single environment variable using the echo command.Eg:echo

Introduction to Linux and common commands getting started with 5--linux shell programming

Shell script to generate test dataVim data_create.shRm-rf./data.txtTouch Data.txtFor ((i=0;iDoStr= ', name ';Name=${i}${str}${i}#echo $nameecho $name >> data.txtDoneecho ' Show TestData 'More Data.txtchmod u+x data_create.shRun the scriptSh-x

Shell script finds Tomcat's PID and path by path

#!/bin/bashif [!-n "$"];thenEcho-e "Usage: $ PATH"Exit 30Fi#T_P =$ (PS aux |grep "$" | grep-v-E "Grep|tomcat_path" |awk ' {print $, $ (NF-3)} ' |sed ' s/-dcatalina.home=/--/g ‘)echo "-pid-------------------PATH----"PS aux |grep "$" | Grep-v-E

Shell command _case

Grammar:Case "Variable" in"Variable 1")...;; #输出两个分号"Variable 2")...;; #输出两个分号"Variable 3")...;; #输出两个分号*)...;; #输出两个分号Esac 123456789101112131415161718192021222324252627 #!/bin/bash# Author:James 2016-10-15echo "want to output

HDU 5730 Shell Necklace (CDQ Division +fft)

mul

"Topic link" http://acm.hdu.edu.cn/showproblem.php?pid=5730"The main topic"Give An array w, representing the weights of the fields of different lengths, such as W[3]=5, if the field length is 3, then its weight is 5, and now there is a field of

Conditional testing of Shell programming

Condition test(a) Concept: to determine the specific conditions to determine how to perform the operation, when the condition is set, the return value of the test statement is 0, otherwise, the other value, meaning if the echo $? The value is 0,

Shell instance: Temporarily solve the problem of automatic disconnection of rsync

Requirements: The company has two backup servers, one from the beginning, every night from the server began to synchronize some data on the main service, but rsync always disconnected, tried a lot of methods are useless, wrote a script to solve this

Condition testing and judgment in the shell

Condition test:To determine whether a demand is satisfied, it needs to be realized by testing mechanism;How to write a test expression to implement the required tests:(1) Execute the command, and use the command status return value to judge;$?:

Mac Setup shell script boot from

Recently need to do a distributed architecture of the site, is currently in the debugging phase, each time the boot to start a lot of tools, such as Zookeeper, ACTIVEMQ, Redis, Nginx and so on, take pains.Search the Internet on the Mac how to set up

Shell command _for

chmod 755 demo.sh./demo.sh 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 6667686970 #!/bin/bash# Author:James 2016-10-15# 集合以空格分割fori in 1 2 3 4 5 6    do   

Eval under the shell in POSIX

In a POSIX shell environment, eval is used to remove a string when the parameter option is used, and the effect is the same as "'", which is useful when writing large numbers of references to more complex scripts. The simple use of bash, usually

Shell Study Note

5.1 Printenv View Global variables Bash New shell Set Global variables and localvariables Export Test Local→global, so it can be

Linux+shell obtaining and copying the latest backup data

Linux+shell obtaining and copying the latest backup dataBefore we introduced some script configuration, today we introduce, using shell script How to copy the most recent files in the specified directory to the specified directory, we copy the files

Linux+shell acquiring and copying the latest data to remote devices

Linux+shell acquiring and copying the latest data to remote devicesOur remote general copy of the data are created by the shared secret key, so that the copy of the words do not have to enter a password, specifically, I can refer to the previous

Shell Summary (0 basic primer)

First, IntroductionThe shell is the command-line interpreter that the user interacts with the operating system.There are many kinds of shells:bash, csh, sh, ksh 、、、The command line we saw when we waited for Linux was a bash.Two, the first

Shell reads file contents

Shell scripts that perform fast and easy to understand code. In the process of writing shell code, it is often used to read the file contents. Notation One:----------------------------------------------------------------------------#!/bin/bash while

Shell Programming-cont.

Shell scripts can be seen as a stack of commands, implemented by combining command flow control mechanisms.The interpreter #!/bin/bash or/usr/bin/python is also known as ShebangThe generic script needs to give execution permission, or you can use

Shell script to check if host is alive

1#!/bin/Bash2prefix=192.168. the3num=14 while["$num"-lt"255"]; Do5 Echo-en"Pinging ${prefix}.${num} ..."6 Ping-c1-w1-t5 ${prefix}.${num} >/dev/NULL 2>&17 if["$?"-eq"0"]; Then8 Echo "OK"&&Echo"${prefix}.${num}" >>Ok.txt9 ElseTen Echo "Failed"&

Shell Display with color font

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-

Total Pages: 541 1 .... 416 417 418 419 420 .... 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.