$: script name, which is the script name entered by the command line$n: Positional parameters, n>0, when n>9, using ${n} form$#: Number of positional parameters"$*": All Positional parameters (single string)[Email protected]: All positional
Format: echo-e "\033[word background color; font Color m string \033[0m"For example:Echo-e "\033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the color of the wordThose ASCII code is the
A If statementif [expression]ThenElif[expression]ThenElseFiNote: There should be a space before and after expression;Then you can start another line, or you can go with the if peers, to add '; ' ;Two Case modeCase Value inMode
1.Shell programming As with Java, PHP programming, as long as there is a code to write a text editor and a can explain the execution of the script interpreter can be#!/bin/sh (#! tells the system that the program specified after the path is the
First, FTP download the current file according to the date#!/bin/bashdate= ' Date +%y%m%d ' ftp-n Second, upload the current file according to the log#!/bin/bashdate= ' Date +%y%m%d ' ftp-n Three, more and catalog upload download#!/bin/bashdate= '
Positional variables:$: Gets the file name of the current execution shell, including the script path if the script is executed with a path $n: Gets the n=1..9 parameter value of the currently executing shell script, which represents the file
Linux shell variables get execution resultsThe method of assigning the result of a command to a variable is:1, use the anti-quotation mark "(number key 1 left key, TAB key above, English way input)such as: A= ' echo ' Hello World ';Assigning the
Tag: The shell connects two scripts.#!/bin/bash##This is for auto run the script to save the time##By [email protected]#chose the latest file and chose one to runarray[0]= ' Ls-lt/mnt/shfw/builds/griffin/experimental | awk ' {print $9} ' | Sed-n '
integer comparison-eq equals, as:if["$a"-eq"$b" ]-ne not equal to, such as:if["$a"-ne"$b" ]-GT greater than, as:if["$a"-gt"$b" ]-ge is greater than or equal to, such as:if["$a"-ge"$b" ]-lt less than, such as:if["$a"-lt"$b" ]-le less than equals,
Shell Statistics Log InformationIn general applications, log information is logged using log4j and a log file is generated daily, with each file ending on the date of the day.How do I count and analyze these log messages?In the simplest cases, use
The conditional operator of awkShows the first line with root[[email protected] ~]# awk-f ': ' $1== ' root ' 1.txtRoot:x:0:0:root:/root:/bin/bashShow first line with root print first paragraph[[email protected] ~]# awk-f ': ' $1== ' root ' {print '}
The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current
Problem Description:LAN built Hadoop Environment, node/home is mounted on a separate disk, a power outage causes several node/home file system corruption, unable to recover, only after formatting and re-mount home/home, and then use the script to
Command: CutOption:-d:-f Specifies the segment divided by ": (separator)" In the first paragraph-c Specifies the number of charactersDescription: Select the command, select a piece of data we want, generally for each row to analyze the
The result returned by the conditional expression is BooleanIt's 1, false is 0.Expressions for conditional tests[Expression][[Expression]]Test expressionCommonly used for:Monocular:-e file Test files exist-F file Test is a normal file-D File Test
Each time on-line, first put the intranet code with Xhell to local. Then drag it to the online server.Dragged and dragged, too slow. So I wrote an online script.Wrote a few versions, this is the final versionscp_v3.shThe contents are as
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.