variable assignment

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)