Shell Operation details finishing (not completed)

Source: Internet
Author: User

In the process of learning Linux, have encountered some small problems, although may be insignificant, but in the pursuit of details often will be more tangled (obsessive-compulsive disorder), empty a blog post space, record some details on the content, are very small very simple things, do not like to spray.


01, BC Calculation floating point problem

When using BC to calculate the number, if the result appears a decimal point, then the content of the decimal point is not displayed by default, then did not care too much.

[Email protected] wangdong]# echo "1500/1024" | Bc1[[email protected] wangdong]# [[email protected] wangdong]# echo "scale=4;1500/1024" | Bc1.4648[[email protected] wangdong]#


02. The IF condition statement determines that the string contains

If the regular usage of if is used, except that the match is not a regular expression, it just matches the string.

[[email protected] wangdong]# cat test.sh #!/bin/basha= "ABCDEFG" if [[$A =~ ']];then echo ' suc ' fi[[email protected] W angdong]# [[email protected] wangdong]# sh test.sh bcdsuc[[email protected] wangdong]# sh test.sh h[[email protected] Wang dong]# sh test.sh gsuc[[email protected] wangdong]#


This article is from "rookie East" blog, please be sure to keep this source http://radish.blog.51cto.com/5944322/1729893

Shell Operation details finishing (not completed)

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.