How to handle dynamic shell in linux

Source: Internet
Author: User
Linux dynamic shell processing method 1. source use ① execution File source $ {filename} ② standard Force source & lt; (echo & quot; xxxxxxx & quot;) Note: The executed command must be clean, note 2.awk& amp; lsquo; $8 $8... linux dynamic shell processing method 1. source use ① execution File source $ {filename} ② standard force input source <(echo "xxxxxxx") Note: The executed command must be clean, it cannot be annotated as it is written in a script. awk '$8 = $ 8' is the same as the tee ① awk column [html] if [! -Z $ sex] & [! "$ Sex"-eq "2"]; then sexCmd = 'awk $8 = '$ {sex} else sexCmd = 'awk $8 = $ 8' fi ② tee [plain] if [! -Z $ sex] & [! "$ Sex"-eq "2"]; then sexCmd = 'awk $8 ===' $ {sex} else sexCmd = 'Tee 'fi is dynamically spliced to run the command [plain] cat $ {tbld}/KOKYAKU_MASTER | $ {kokyakuidCmd} | $ {sexCmd} | $ {nenreiCmd} | $ {nendaiCmd} | $ {gurupuCmd} tested: compared with awk, tee saves quite a lot of time in dynamic splicing. the most disgusting thing is single quotes. this is a strong reference of input. you must control a stupid way: in dynamic concatenation, two single quotes are equivalent to a single quotation mark (the same as the dynamic concatenation of MSSQL), because in the test, the following is found when the sexCmd variable is assigned a value: [html] + sexCmd = 'awk $8 = 1, automatically becomes the valid awk execution method [plain] + cat/BSK/TBL/KOKYAKU_MASTER + tee + awk '$8 = 1'
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.