mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
22 lines
254 B
Bash
22 lines
254 B
Bash
#!/bin/bash
|
|
|
|
# demonstrating the local keyword
|
|
|
|
function func1 {
|
|
local temp=$[ $value +5 ]
|
|
result=$[ $temp * 2 ]
|
|
}
|
|
|
|
temp=4
|
|
value=6
|
|
|
|
func1
|
|
|
|
echo "The result is $result"
|
|
if [ $temp -gt $value ]
|
|
then
|
|
echo "temp is larger"
|
|
else
|
|
echo "temp is smaller"
|
|
fi
|