1. for arithmetic operations. There are several assignment methods:
Let a = 1 + 2
Echo $
A = $(3 + 3 ))
Echo $
A = $ [4*4]
Echo "$"
Set $ [A = 5*5]
Echo "$"
2. Determine whether a directory exists:
If [-d "$ (PWD)/.../candpointer"]; then
Echo "../candpointer directory exsits ."
Fi
3. Usage:
Echo Al. {txt, GZ}
-> Al.txt al.gz
$ {} Usage:
$ {A }== $
$ (CMD)
Eg. Echo "$ (LS-l )"
$ [Expression]
For usage, see.
{} Also has a usage, which is used as the file input and saved to the variable in rows:
File = condition. Sh
{
Read line1
Read line2
} <$ File
4. judge whether a string is null:
If [-z "$1"]
then
echo "useage: 'basename $ 0' [domain-name] "
exit $ e_noargs
fi
5. ifs usage. Ifs serves as the default delimiter for output. It is useful to separate corresponding characters in shell.
note: the default value of IFS Variable is ""
test the following usage:
Var = "'(] \\{}\\$ \" "
echo $ var
echo" $ Var "
ifs =' \ '
echo $ var
echo "$ Var"