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 Learning Notes# #变量# #普通变量:EG1:Name=axeEcho $nameps. equals two times cannot have a space, otherwise it will be an error.EG2:Name= "Axe Prpr"Echo $nameOrName= ' Axe PRPR 'Echo $namePS. Double quotes can refer to other variables, single
As an example:gawk 'begin{var["a"]=1var["g"]=2var["m"]=3var["u"]=4Asort (var,test) for(Iinchtest) Print"Index:"I"-Value:", test[1]}'When you hit enter, you can output4 1 1 12 13 1 The script in front of the time because the electronic version
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"
///
1.1 Shell prompt[Email protected] ~]$If the last character is "#", it indicates that the current Terminal session has Superuser privileges. This permission can be obtained by logging in with the root user or using a terminal that provides superuser
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
1. Examples of error methodsAVar=1+1Echo $varThe result of the output is the same, tragedy, hehebVar=1var= $var +1Echo $varOutput is the same, still tragic, hehe2. Correct method1) Use LetVar=1Let "Var+=1"Echo $varThe output is 2, no tragedy this
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
1. Definition:The crontab command is commonly used in Unix-and Unix-like operating systems to set instructions that are executed periodically. The command reads the instruction from the standard input device and stores it in a "crontab" file for
Today's operation encountered a problem, need to redirect the content to the file, and then rename the use of the file, the result of the redirection has been thrown out of the exception, the following nature will be followed by a variety of
Write a script:1, create a function, can accept two parameters:1) The first parameter is a URL, you can download the file, the second parameter is a directory, that is, the location of the download after the save;2) If the user-given directory does
The format of the statement is: Getopts The general format is:Getopts option_string VariableWhere option_string contains a valid single-character option. If the getopts command finds a hyphen on the command line, it is compared with the word
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
The MAC server needs to turn on Telnet first. Open with: System Preferences, share check remote loginCommon commands are:Copy (copy the native file to the remote server) Scp-r Local path/file userName@192. 168. XXX. XX:/tmp#userName为远程服务器用户名称,
CTRL r: Command line appears reverse-i-search, input character will match command in input historyCTRL P: Go ahead and look through historyCtrl N: Looking back over historyCtrl A: Command headerCtrl e: Command line endCtrl F: Jump forward one
(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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service