Shell Learning Note

Source: Internet
Author: User

Tag:expr   bsp    Command    not   csharp    other   filename    line    awk   

Shell Learning notemain= "/usr/local/" # Variable uppercase status= "$MAIN/status" # USD multibyte string is a reference variable value, while USD multibyte number indicates command line parameter echo "some words" > > $STATUS/log.logecho "test.sh start at ' date ' +%m/%d%h:%m:%s '" >> $STATUS/log.logcat $FILE | Grep-v "#" > $OTHERFILE. list#-V Culling # lines beginning with year= ' date +%y echo $LINE | Awk-f "+" ' {print $var} ' #-F with ' + ' as the delimiter if [-S ' ${path}/test.list ']# if the file exists is not 0 o'clock true if [-N ' $var 1 "-o-n" var2 "]#-n when the length of the string is large True at 0 o'clock (string non-empty)-a,-o,! Logic with, or, non-# ${ARGS1}_$ARGS2 plus {} is to make it clearer that args is a variable rather than a args_, and does not confuse variables when encountering multiple parameters thenfor line in ' Cat $file ' do# substr (s,p,n) Returns the suffix portion of the string s starting from p in length n exam:substr ($string, 0,length (1)) Result:sfilename = ' echo $LINE | Awk-f "+" ' {print substr ($1,0,1)} ' expr $value \* $timesif ["$flag"-eq "1"]thencheckflag= ' Checkschedule "${args1}" "$Arg S2 "' # Checkflag equals Checkschedule function return value, $Args 1 is the incoming parameter func" $var 1 "" $var 2 "#传入var1, 2 to function func () Fidonefifunc () {var1=$1var2=$ 2}

Shell Learning Note

Related Article

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.