자기발전소/# Programming
Bash_shell script 함수 기초
iamlucia
2020. 6. 2. 18:58
함수를 활용하기
입력값/
enter a value : _____
출력값/
the number is odd
the number is even
#!/bin/bash
function calcul {
if (( $number%2 == 0 ))
then
echo "even"
else
echo "odd"
fi
}
read -p "ENTER A VALUE : " number;
result=$(calcul);
echo "THE NUMBER IS $result"