An example of a netizen shell 20140702

Source: Internet
Author: User

After a netizen watched the old boy's shell video today, he asked the following question:

650) This. width = 650; "Title =" snap17.jpg "alt =" wkiol1oz8i_gwllfaaetvavr46c745.jpg "src =" http://s3.51cto.com/wyfs02/M00/38/8A/wKioL1Oz8i_gWlLFAAEtVAvr46c745.jpg "/>

Solution:

The best way to learn shell is to refer to the benchmark script of the system and example of help.
The following is an example of the nic startup script for this user.

650) This. width = 650; "style =" float: none; "Title =" image003.png "alt =" wkiol1oz8emwtevkaac7nd7sblc481.jpg "src =" http://s3.51cto.com/wyfs02/M01/38/8A/wKioL1Oz8emwtevkAAC7Nd7SBlc481.jpg "/>

Obviously, the above-mentioned brackets compare the equal signs with spaces on both sides. Therefore, the answer to the above questions is self-evident.

[[email protected] ~]# cat oldboytest.sh #!/bin/shstra=‘aa‘strb=‘bb‘ if [ "$stra" == "aa" -a "$strb" == "bb" ];then  echo "true"else  echo "false"fi  if [[ "$stra" == "aa" && "$strb" == "cc" ]];then  echo "true"else  echo "false"fi[[email protected] ~]# sh oldboytest.sh  truefalse

Pay attention to details: especially spaces that are easy to ignore, which is critical in shell.

This article from the "old boy Linux O & M" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1433688

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.