Shell script detects root partition hard disk space utilization

#!/bin/baship=$ (ifconfig eth0 |grep "inet addr" | awk ' {print $} ' |cut-f1-d ":") a=$ (df-h |grep/dev/sda2 |awk ' {print $} ' |cut-f1 -B "%") #截取分区使用率If [$a-ge] then echo "$IP the server root partition is about to have no space, please clean it up

Shell script timed background execution

1. Use the & symbol to execute commands in the backgroundYou can add the & symbol to the Linux command or script to make the command or script execute in the background, for example:.$./my-shell-script.sh &2. Use Nohup to execute commands in the

Shell scripts for quick deployment of Tomcat projects

In order to do cluster testing, 3 tomcat is installed on each machine, each time the project is released, it is necessary to repeatedly knock some commands, check that the Tomcat process has not stopped before restarting Tomcat, and kill the process

008-shell Process Control

First, if else1.1, ifIf statement syntax format:if condition Then command1 command2 ... fiWrite a line (for the terminal command prompt):if [$ (PSgrep"ssh"1thenecho" True"fiAt the end of the fi is if the upside-down spelling, and later

Shell script case (ii) bulk delete users

Case-then the previous caseWant to bulk delete all users created in the previous caseScript Show: (Next time explain)#!/bin/bashecho > userlist.txt;for i in `seq 50`do id student$i >/dev/null 2>/dev/null; [ $? -ne 0 ] && echo -e "[\033[31merror\033

Export and Source,bash in shell scripts

1.export commandThe Linux Export command is used to set or display environment variables.When executing a program in the shell, the shell provides a set of environment variables. Export can add, modify, or delete environment variables for use by

Shell Scripting Exercises

1, write the script/root/bin/createuser.sh, to achieve the following functions: Use a user name as a parameter, if the specified parameter of the user exists, it will show its existence, otherwise added; Displays the ID number of the added user and

Use of function functions for shell scripts

Use of function functions for shell scripts? The basic things in front of the introduction, the following we introduce the function how to use.? Note: The function needs to be declared before it can be used.? The declared keyword can be used with

Shell daily operations shell Command collection

1. Date view modify system time and dateDate-DDisplays the time of the string description-FShow each line of time in the Datefile file-RDisplays the last modified time of the file-RDisplay time in RFC-2822 compatible date format-rfc-2822Display time

Use of SED tools and regular expressions (Shell fourth day)

Sed tool "streaming editor"--Non-interactive, filter based on pattern matching and modify text--progressive processing and output of the results to the screen--can achieve the output of the text, delete, replace, copy, cut, import, export and other

Shell file expression

file Expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if

Shell Programming (1)

1/ETC/PASSWD: User account information/etc/shadow: Secure user account information/etc/group: Group account information/etc/gshadow: Security group account information2ID: View the user ID and group ID of the current userId-u: Show only User IDId-u

Linux Shell Programming (eight): Looping structure

Looping statementsThe looping statements in the shell are as follows: for while unitl case select For/while/unitl must end with done forCycleforLoops are used to iterate through an array (data list) or

Basic Shell Command 2

2. process file 2.1 Create file TouchIf you want to change the access time only, you can use the-a parameter.$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:35 Test_one$ touch-a Test_one$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:

Pipe and job control, shell variables, environment variable configuration files

Pipe character and job control | Give the result of the previous command to the following command processing.[[email protected] ~]# cat 1.txt |wc -l 统计行数5[[email protected] ~]# cat 1.txt |grep ‘aaa‘aaaa 剪切出aaa的行 CTRL Z pauses a task,

Shell Programming--case judgment

Case Base Syntax:Format case?? Variable name invalue1)Command;;value2)Command;;*)Commond;;EsacIn a case program, you can use the |, meaning, or means of a condition, such as???2|3)Command;;Script[[email protected] shell]# vim case.sh #!/bin/bashread

Shell Logic judgment

Format 1:if condition; Then statement; FiFormat 2:if condition; Then statement; else statement; FiFormat 3:if ...; Then ...; Elif ...; Then ...; else ...; FiLogical judgment expression: if [$a-gt $b]; If [$a-lt 5]; If [$b-eq 10] et-gt (>); -lt (=); -

Shell Script Basics (ii)

I. Logical judgment in shell Scripts 1, Judgment statement IFA) without elseFormat:if 判断语句;then commandfiInstance:[[email protected] shell]# vim if01.sh //判断数值大小第一种方法用[],注意前后空格#! /bin/basha=5if [ $a -gt 3 ];then echo

Shell Variable Introduction

Variable naming rules变量名必须以字母或下划线开头,名字中间只能由字母,数字和下划线组成,大小写是区分的变量名的长度不得超过255个字符变量名在有效的范围内必须是唯一的在Bash中,变量的默认类型都是字符串类型"用户自定义变量" ? ?变量自定义的"环境变量" ? ?这种变量中主要保存的是和操作环境相关的数据。变量可以自定义,但是对系统生效的环境变量名和变量作用是固定的。"位置参数变量" ? ?

Nine arrays in the shell

Array: A variable that stores a set of data and is able to manipulate one of the data in this set of data individually.Types of arrays: one-dimensional arrays, two-dimensional arrays, multidimensional arraysTypes of variablesThe default value of an

Total Pages: 541 1 .... 314 315 316 317 318 .... 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.