美文网首页
variable assignment

variable assignment

作者: cutelittlePanda | 来源:发表于2018-03-28 20:39 被阅读0次

1. Assignment operator '=', without any space before and after;

    a). var0=`commands`     ###assign the results to variable with backquotes``

    b). var1=$(commands)     ###commands subsitution

        eg.   ###> arch=$(uname -m)

                ###>echo $arch

    c). var2=234

    d). var3="this is a string with whitespace, using double quoting to prevent words splitting"

    e). var4='this line is not the same as above assignment,cause it's single quoting, not double'

    f).  a=2

        let b=$a+1     ###if without 'let', errors, ( b = 2+1)

        echo $b    ### 3

2. Bash variables are untyped.

相关文章

网友评论

      本文标题:variable assignment

      本文链接:https://www.haomeiwen.com/subject/vhfgqftx.html