${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
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
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
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
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"
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 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,
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
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"
///
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
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:
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.|
• 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
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
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
(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
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
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
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.