Linux shell if conditional expression summary __linux

Overview: In Linux shell programming, there are many conditional expressions for comparison/judgment, and this article makes a brief summary of them. 1. String comparison! Take the anti-n str string STR is NOT NULL -Z str string str is NULL STR1 =

Shell script statistic files carding and gain disk occupancy

1. Use shell script get_file_stat.sh statistics The number of directories in the bin directory executable file number, text file number #!/bin/bashCd/binDir= ' ls-l |grep "^d" | Wc-l 'Exefile= ' Find/bin-perm +111| Wc-l 'Txt_file= ' Find/bin-name "*

Ubuntu write boot from shell script

1. First, write a simple shell script Vimtest.sh (Nano is not used to use VIM) Enter Vim and press the I key, then enter (#!/bin/sh symbol #! to tell the system that its subsequent parameters are the program used to execute the file.) )

Special variables in the shell $ $ $# $$ $! $? meaning __shell Script

$: The name of the executing script $* and $@: Return all parameters to $#: The number of arguments $_: represents the last parameter of the previous command $$: The PID $! that represents the command that was last executed: The PID $?: A flag that

Simple example of a shell script

1. Analog Linnux Login Shell #/bin/bashEcho-n "Login:"Read nameEcho-n "Password:"Read passwdif [$name = "CHT"-a $passwd = "abc"];thenecho "The host and password is right!"else echo "Input is error!"Fi 2. Compare the size of two

The use of the If "-e,-d,-f" in the shell under Linux

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

The shell extracts the file suffix name and determines whether it is a specific string

If the file is a. css file or a. js file, it is processed.file=$1if ["${file##*.}" x = "css" x]| | ["${file##*.}" x = "JS" x];then do somethingfiAttention:1> extract file suffix name: ${file##*.}# #是贪婪操作符, match from left to right, match to the

Shell Script 3

# Experimental Case One,**Writing sysmon.sh Scripts(1) Use the DF command to extract the disk occupancy of the root partition and assign a value to the variable dug.(2) Use the Mpstat command to extract the CPU usage (Install the SYSSTAT package)

linux--more practical shell commands

1) Count the number of rows in the index.php file in the current directory[[email protected]_web1 ~]# cat index.php |wc -l172) Statistics web directory, JS file number:[[email protected]_web1 ~]# find web/ -name "*.js" |wc -l3) Statistics web

Shell Programming-Introduction (I.)

1. Shell ConceptThe shell is a program written in C, which is a bridge for users to use LinuxThe shell is both a command voice and a programming voiceA shell is an application that provides an interface through which users access the operating

BASH Shell for loops 1 to 100

Preface written using BASH Shell ProgramThe for loop is often used, especially from 1 to 100. Here we record several types of loop method classes in shell from 1 to 100. C Language For (I = 1; I In usage For I in {1 .. 100} doecho $ idone SEQ

BASH Shell learning-array

Definition Method Subscript array direct assignment #! /Bin/basharr [0] = "one" arr [1] = "two" arr [2] = "three" for num in $ {arr [*]} doecho $ numdone Sequential assignment of parentheses Arr = ("four" "five" "six") for num in $ {arr [*]}

Cron commands in Linux & Unix shell programming guide

  1. run commands in the background Cron: System scheduling process. It can be used to run jobs during off-peak hours every day, or during different periods of one week or one month.At: Command. It is used to run some special jobs at a specific time,

How to compile Linux Shell script (1)

I am studying Linux Shell script recently.Linux Shell scripting tutorial (LSST) v1.05r3But because it is in English, it is also a deep impression. Now, go to the topic. 1. How to Write shell script? A. First, use any Compiler (Vi, Vim, kwrite,...)

Use of Linux Shell Variables

I. Use of local variables Local variables act only in this shell, just like local variables. It does not affect variables in other shells. 1. Show variable valuesYou can use the echo command. Note that you must add the $ symbol before the variable

Shell parses the INI File

Create a shell to parse the INI file and use it to parse the ini configuration file in the HA framework. The tested INI file is one found in the system. # Example driver definitions# Driver from the postgresql-odbc package# Setup from the unixODBC

Judgment expressions for Linux shell commands such as-D,-F, and-e

Source: http://zhidao.baidu.com/question/322131711.html   File comparison operator-E filename if filename exists, it is true [-E/var/log/syslog]-D filename if filename is a directory, it is true [-D/tmp/mydir]-F filename if filename is a regular

If parameters in Shell in Linux

If parameters in Shell in Linux[-A file] true if the file exists.[-B file] If the file exists and is a special block file, it is true.[-C file] If the file exists and is a special word file, it is true.[-D file] If the file exists and is a directory,

BASH Shell for concurrent multi-process operations

Preface The basic languages I have mastered: PhP (most familiar with, the code in the project is implemented using it), bash shell (O & M tool), and C (ACM dedicated ), it seems that only C can implement multithreading, but C is only used to learn

Brief introduction and application of shell script program

Notes for shell script programs: variables can be directly used without prior declaration; the variable does not have any data type. The default value is a string; no space is allowed on any side of the equal sign of the value assignment operation.

Total Pages: 541 1 .... 399 400 401 402 403 .... 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.