Shell function usage attempt

Source: Internet
Author: User
Shell function-based usage tries to find all the configuration file content in each program directory in a loop function www.2cto.com #. the parameter is the name of the file to be processed and the function to be processed whilefun () # arg1file $1, arg2cmd $2 {whilereadlinedo $2...
Shell function-based usage tries to find all the configuration file content in each program directory in a loop function www.2cto.com #. the parameter is the name of the file to be processed and the function to be processed whilefun () # arg1 file $1, arg2 cmd $2 {while read linedo $2 $ linedone <$1} # handler, column file name and cat file content custcmd2 () # arg1 $ line {echo -------------------------- c2 ----- list filedir $1 echocat $1} # process the function, obtain the Directory, locate the conf file, and process each conf file custcmd () in sequence () # arg1 $ line {cfdir = 'dirname $1 'cd $ cfdir echo ---------------------------- c1 ---------------------------- ls *. conf>/tmp/tmpfcf2 echo .. cat/tmp/tmpfcf2whilefun/tmp/tmpfcf2 custcmd2} # find the program running ps-ef | grep home | grep server | grep-v grep | awk '{print $8 }' >/tmp/tmpfcf; # start whilefun/tmp/tmpfcf custcmd
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.