Practice and production practice of shell variable substitution technology

${value:-word}If the variable name exists and is not NULL, the value of the variable is returned, otherwise the word string is returned.${value:=word}If the variable name exists and is not NULL, the value of the variable is returned, otherwise, the

Getting Started with Shell Programming (second Edition) (middle)

variable test Statement-testFunction: Used to test whether the variable is equal, is empty, file type, and so on.Format:Test tested Condition or []#范围: Integer, String. File1) integer test :Test int1-eq int2 test integers are equalTest int1-ge int2

Special symbols in shell scripts

The special symbols commonly used in the shell are listed as follows: #;;; . ,/\ \ ' String ' |! $ ${} $? $$ $*\ "string\" * * *? : ^ $# [email protected] ' command ' {} [] [[]] () (()) | | && {Xx,yy,zz,...} ~ ~+ ~-& \\ +-%= = =!=# well (comments)

Shell script Programming-structured Command 2-for command

1. For command (1) syntax for Val in list; Do commands doneThe list parameter provides some values for the iteration, and the Val value is assigned to the value in list, knowing that the list polling ends.Commands can be one or more

Linux Shell if

If usage:if []; thenCommandelif []; thenCommandElseCommandFiIf parameter:Used in shell programming to determine parameters within an if statement–b return True when file exists and is a block file-C Returns True when file exists and is a character-D

How to modify the output effect of the Linux shell (interface color)

The color of the text terminal can be generated by using the ANSI unconventional character sequence. Example:Echo-e "\033[44;37;5m ME \033[0m COOL"The above command sets the background to blue, foreground white, blinking cursor, output character "ME"

Rails+unicorn+nginx configuration, Shell startup scripts

1. Nginx configuration file1.1, the project directory is placed in the system/var/www/Upstream App {# Path to Unicorn SOCK file, as defined Previouslyserver unix:/var/www/app/shared/sockets/unicorn.sock Fail_ timeout=0; #server 127.0.0.1:4000

Shell Special Variable character interception

Shell Special variablesVariable meaning$ $ Gets the script name of the currently executing shell script, including the path and script name if the script has a path$n Gets the nth parameter in the currently executing shell script. But when n=1..9,

Part IV Shell Programming 5 Project Two distribution system

The first part: expect explanationExpect allows us to automatically log on to remote machines, and can implement automatic remote execution of commands. Of course, if you use key authentication without a password, you can also implement automatic

Shell Date Time addition minus

1. Using the DATE-D optionDate + "%y%m%d"-D "+n days" today's post N day datesDate + "%y%m%d"-D "-N days" today's top N Day dates2. Common date formatPython [[email protected] tmp] # date + "%F" -- [[email protected] tmp] # date + "%d" ///

An example of application of sed command and Shell's if statement

if [-f/etc/syslog.conf]; #判断文件是否存在Thensystest= ' sed-n '/^auth.info/p '/etc/syslog.conf '; #匹配 the/etc/syslog.conf file has a auto.info string and returns a string, Systest variable is received.if [-n \ "\ $systest \"]; #判断字符串是否存在ThenSed-e ' s/^auth.

Linux shell Scripts-Basic Learning Notes

Linux scripting is not too strong, and recently tutorial, after all, Linux shell in the daily work is still very common,It is more convenient to use, save time and effort.Here are the study notes, partial theory, followed by a few examples for

Shell function definition and invocation

I. Function definition Grammar: [function] functionname[()]{action; [return int;]} Description 1, can be with function fun () definition, you can also directly fun () definition, without any parameters. 2, the parameter returns, can display add:

Linux Programming (ii) Shell programming

1. Piping and redirectionFile descriptor 0: standard input for a programFile descriptor 1: Standard outputFile descriptor 2: standard error output> Operator: Redirects the standard output to a file.>> operator: Attaches the output to a file.|

Linux--shift command-shell function-shell script Combat

• Execute an error after importing scripts from Windows into a Linux systemshift parameter Left SHIFT commandHow to use functions in shellshell script Combat: MySQL automatic backup and automatic decompression zip file scriptError after importing

Zabbix Auto-discovery combined with Shell enables Autodiscover to consume the largest TOP10 process and monitor its resources

Recently in the thinking of a problem, the online server run a variety of services, it may be running Nginx, another run is MySQL, the other is to run NFS or other services, etc. Through a certain script fixed write some services to implement

Crontab let Linux execute shell scripts at timed intervals

Use crontab you can perform a specified time in the Shell script or a series of Linux command. For example, the system administrator schedules a backup task to run every dayEntry# crontab–eThis enables the edit mode to open the personal crontab

Shell scripts that automatically purge expired tomcat logs

(Friendly hint: This article belongs to the elementary shell programming, the Master can ignore this article)During the operation of the product environment, daily log files are cut to produce the day-to-date logs, which are generally not useful

Shell Scripting and Destiny

variables, functions, definitions and references, which are expressed in many ways, I choose the following: Variable name = ' destined ' #变量定义$ variable Name #变量的引用Function name (){Destined 1;Destined 2;.....} #函数的定义Function name #函数的引用For

Bash Shell Array

In bash shell, the handling of arrays is an error-prone place.Array:Variable: Stores the memory space of a single element;Array: A contiguous memory space that stores multiple elements;Array nameIndex: Numbering starting from 0, is a numeric

Total Pages: 541 1 .... 134 135 136 137 138 .... 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.