Shell script (3)-loop statement

For statement1. For statement1) IntroductionIn the actual work, often encounter a task to be executed multiple times. Each execution is simply a different object, with the same other commands. For example, create a system account based on the list

Shell Script--Initial CGI

CGI according to the definition of Baidu Encyclopedia, as follows:CGI is the specification of external programs when the Web server is running, and programs written by CGI can extend server functionality. CGI applications can interact with the

The role of various parentheses in the shell (), (()), [], [[]], {}

One, parenthesis, parentheses ()1, single parenthesis ()?? ① Command Group. The commands in parentheses will run in a new sub-shell sequence. So the variables in parentheses cannot be used by the rest of the script. Multiple commands in parentheses

Shell [] differs from [[]]

[] and [[]] can determine whether the variable is empty, [ $a] [[$a]] [ ! $a] [[! $a]] No differenceIn Linux, we can use the test command to determine if a string is empty, and the test command gives us the "-Z option" and the "-N option," which you

Shell Scripting Learning Notes-string test expressions

1.1 String test operatorThe string test operator has the function of comparing whether two strings are the same, whether the length of a string is zero, whether the string is null (NOTE: Bash distinguishes between 0-length strings and empty strings,

Linux Learning Summary (17)-shell Basics

The content of this article is very miscellaneous, but it is not difficult to understand, do not map by example.First introduce several characters commonly used characters:1 * matches any of any characters2? Match an arbitrary character3 # comment

Examples of expect and shell nesting use

#!/bin/shmaildir=/maildata/mailbox/gxm.cn/0olddir=/home/mailboxnewdir=/maildata/mailboxecho  ""  >/ root/lostmailidecho  ""  >/root/lostmailidokfor mailid in  "cat /usr/local/ Kkmail/log/app/postman.log.2018-03-06 | awk -f " "   ' {print $4} '

The order in which the Bash shell launches the configuration script

1. The way bash checks the environment variable file depends on how the system runs the shell, typically there are 3 ways the system runs the shell:1 shell that runs by default after the system user logs on 2 ) Non-login interactive run shell 3)

Shell logic judgment, file attribute judgment, if special usage, case judgment

Logical-judgment logical expressions in shell scripts are used in [] (brackets): -lt:=little than less than -le:=little && wqual less than equals -eq:=equal equals -ne:=no Equal Not equal to -gt:=greater than greater than

Conditional judgment and comparison of shell scripts

common syntax for conditional testing: Syntax format Description [] [] has at least one space between the boundary and the content [[ ]] [[] There is at least one space between the

Shell built-in commands and operating methods

1.!#/bin/bashThis is the first line of the shell script, and/bin/bash represents the location of the script's interpreter.2. Run the script:    (1) Bash test.sh(2) Bash-x test.sh (ps:-x for observing script running state)(3) Release script

Shell scripts-making your own service scripts

Let's start with an example: Suppose you have a test service that can start, shut down, or restart test by command, the following script simulates this feature:#!/bin/bash#test.shcase $ in start) echo "Starting service ..." sleep 1

(Stone, scissors, cloth) shell scripts, random comparisons, case applications

Script Realization Man-machine Game, Machine Application random method, combined with user input to give the result, the article has two methods, the first method is the logical aspect of the script, the second is easier to understand.One: The

Shell script app (for, while, Case statement application)

1, for: Read different variable values, execute the same set of commands one by one, until the value is complete exit, variable values are separated by a spaceSyntax: For variable value in value listDoCommandDone2, while: Repeated testing a

Configuration and optimization practices for the Shell Scripting development environment

Configuration knowledge such as Vim path is shown in table: Related configuration Files Function description . viminfo User's operation history using Vim . VIMRC Configuration file for

Shell gets string length

Method 1: Use the wc-l commandWc-l can get the length of the current row, so the string for a single row can be obtained in this simple way, and the wc-l is the number of rows that get the current string content.The code is as follows: Echo "ABC"

Shell script first-Custom create user and batch create user

Shell Script First-Custom create user and batch create user 1. build Linux users with shell scripts# vim/root/user.sh#!/bin/bash#通过脚本自定义创建用户read-p " Please enter the user name you want to create : " $Useradd $read-p " Please set the user password:

Shell Foundation (i): Shell basic Application, simple shell script design, using shell variables, variable extension application

First, Shell basic applicationTarget:This case requires familiarity with the characteristics of the Linux shell environment, mainly practicing the following actions:1> switching the user's shell environment2> Practice Command History, command

Shell printf Command

In the previous section we learned about the Shell's echo command, which we'll learn from the Shell's other output command printf.The printf command mimics the printf () program in the C library.printf is defined more by the POSIX standard, so a

function in shell, array of shell, demand analysis of alarm system

Functions in the shell The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly. 格式: function f_name() { ?? ?? ?? ?? ?? ?? ?

Total Pages: 541 1 .... 161 162 163 164 165 .... 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.