Control judgment statements in shell programming

If Single-format and nested if conditional expression; then #当条件为真时执行以下语句 command list else #为假时执行以下语句 command List fiif Statements can also be nested using an if condition expression 1;then if condition expression

2.5-shell Programming Preliminary

Previously review:File management, user management, rights Management, Bash's basic featuresFile Management: CP,MV,RMUser

Shell Programming (v)

Learning from the previous articles, we learned the basic syntax of the shell. In the actual operation of Linux, we often see the command will have many parameters, such as: Ls-al, and so on, then how this parameter is handled? Let's take a look at

Qualified Linux OPS personnel must be 30 shell programming surface questions and explanations-08

Enterprise Actual combat Problem 8: How to implement the MySQL database for sub-library backup, please use the script to implementMy script

Qualified Linux OPS personnel must be 30 shell programming surface questions and explanations-09

Enterprise Actual Combat Problem 9: How to implement the MySQL database sub-Library plus table backup, please use the script to implementMy script

Shell finishing (31) = = = To determine if the input is IP

(title): Determine if the incoming parameter is IPIdea: 192.168.1.1is the condition of the IP, * * * dot decimal This four number must be less than 255Dot decimal must be guaranteed to be a number, not a letter#!/bin/bash[ -z $1 ] && echo  "uesage : 

Shell Script Learning Notes

1./dev/null/dev/zero ①/dev/null:/dev/null, called an empty device, is a special device file that discards everything written to it (but reports a successful write operation) and reads it immediately to get an EOF. In Unix jargon,/dev/null is called

Rsync starts closing shell scripts

This script can be placed in the/etc/init.d/directory with service RSYNCD Start\stop\status\restart management, you can also use Chkconfig for boot-start management, detailed script content as follows:#!/bin/bash# ************************************

Shell finishing (37) = = = Variable understanding and two exercises

1/etc/profile2 ~/.bash_profile3 ~/.BASHRC4 $PATHWhere/etc/profile is the global environment variable that takes effect for all users, while. Bash_profile only works on the current user.~/.bash_profile: Each user can use this file to enter shell

Common shell commands

1. 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. -name ' apf44_zswmpay* ' |xargs grep applog|awk-f ": '

Shell finishing (36) = = = Read the rules and write the series

(a) write the series as shown below[Email protected] ding1]# bash 5.sh2/13/25/38/513/821/1334/2155/3489/55144/89233/144The shell code is as follows:#!/bin/bash>aa>bbEcho 1 2 | Xargs-n1 >AAFor i in ' seq 20 'DoA= ' Cat AA | Sed-n ' $i ' P 'b= ' Cat

[Turn]bash shell common shortcut keys

Tag: will return CTR Word delete Move page ackMove cursor ctrl+b: Move forward one character (backward) ctrl+f: Move back one character (forward) alt+b: Move forward one word alt+f: Move back one word ctrl+a: Move to the

Shell Join detailed

First paste one, join--helpusage:join [OPTION] ... FILE1 File2for Each pair of the input lines with the identical join fields, write a line tostandard output. thedefault join field is the first, delimitedby whitespace. When FILE1 or FILE2 (not

[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

Implements a simple shell sed replacement function

You can use the script to pass parameters to implement the substitution#-*-coding:utf-8-*-#Author:sunhaoImportSYSF= Open ('Yesterday','R', encoding='Utf-8') F_new= Open ('Yesterday.bak','W', encoding='Utf-8') Find_str=sys.argv[1]replace_str=sys.argv[

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

Shell Transfer Array Parameters!

Knowledge Points: Array function Local Variables Defining pass-through parameters Example 1:A= (1 2 3) b= (a B c) function () {Local a=$1 local b=$2 for I in $a does echo $i done Ech o $b}funcition "${a[*]}" "${b[*]}" Result: 12

"Arrays" in the shell

Defining arraysArray name = (value 1 value 2 ...) Value N)[Email protected] ~]# array_name= (value1 value2 value3 value4)Reading an array${array name [subscript]}[Email protected] ~]# Echo"${array_name}"Value1[[email protected]-r3-srv ~]#

Linux command Detailed (10) An array of shell scripts

1. Array definition[[email protected] ~]# a= (12345678) [ [Email protected] -IDC ~]# Echo $aA pair of parentheses indicates an array, and the elements of the array are separated by a "space" symbol.2. Array reading and Assignment1) Get the length

Cow farming learning shell bubble sort

#!/bin/bash############################################################### File Name:/server/scripts/maopaopao.sh# version:v1.0# Author: Cattle Farming# Created time:2017-09-20 19:44:10# Description: Bubble sort# Read Instructions:# 1, read-a

Total Pages: 541 1 .... 406 407 408 409 410 .... 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.