I created it as a small story of Bash programming. Was it popular in the past? A multiple of 3 or a number that includes 3 is aho.
#!/bin/bash
echo -n "Please input end number => "
read num
count=1
while (( $count <= $num ))
do
if (( $count % 3 == 0 ))
then
echo "aho"
else if [ "`echo $count | grep 3`" ]
then
echo "aho"
else
echo $count
fi
fi
(( count+=1 ))
sleep 1
done
$ ./aho.sh
Please input end number => 15
1
2
aho
4
5
aho
7
8
aho
10
11
aho
aho
14
aho
By creating this program
--Branch syntax --Repeating syntax --test command ([] or ``) --Bash's manners
I understand.
Recommended Posts