1. Create a constant variable
A constant variable is a variable that is always constant in the experiment, it never changes.
declare -r var
declare -r varName=value
declare -r pwdfile=/etc/passwd
echo $pwdfile
pwdfile=/etc/foo.txt
2. Create an integer variable
An integer data type (variable) is any type of number without a fractional part.
declare -i var
declare -i varName=value
declare -i y
y=10
[ $y -eq 0 ] && echo "Y is set to a zero number." || echo "Y is set to a nonzero number."
y="foo"
[ $y -eq 0 ] && echo "Y is set to a zero number." || echo "Y is set to a nonzero number."
3. Create an array
No comments:
Post a Comment