variable

    1. # work
    2. foo=bar
    3. echo $foo
    4. > bar
    5. # not work
    6. foo = bar
    7. > command not found: foo
    8. echo "value is $foo"
    9. > value is bar

    reserved command

    1. # the name of the script
    2. $0
    3. # the first-ninth argument that scirpt takes
    4. $1-9
    5. # the last argument of the previous command
    6. $_
    7. mkdir test
    8. cd $_
    9. # get the error code from the previous command
    10. $?
    11. # get the previous command
    12. !!

    functions

    1. # mcd.sh
    2. mcd () {
    3. # $1 means the first argument of input
    4. mkdir -p "$1"
    5. cd "$1"
    6. }
    7. # execute this script in our shell and load it
    8. source msc.sh
    9. # now you can use the function in msc.sh defined
    10. mcd test