Monday, January 14, 2013

Bash Looping

Program Bash Looping ( Sistem Operasi )

1. Masuk ke directory bash :
    ketik, nano looping.sh

2. Copy teks yang ada di bawah ini ke terminal.


choice=5
echo "1. Android"
echo "2. Iphone"
echo "3. Windows_Phone"
echo "4. Fendi"
echo -n "Silahkan pilih kata [1,2,3,4]?"

while [ $choice -eq 5 ]; do

read choice
if [ $choice -eq 1 ];then
echo "you have chosen word: Android"
else

if [ $choice -eq 2 ];then
echo "you have chosen word: Iphone"
else

if [ $choice -eq 3 ];then
echo "you have chosen word: Windows_Phone"
else

if [ $choice -eq 4 ];then
echo "you have chosen word: Fendi"
else

echo "please make s choice between 1-4!"
echo "1. Android"
echo "2. Iphone"
echo "3. Windows_Phone"
echo "4. Fendi"
echo -n "Silahkan pilih kata [1,2,3,4]?"
choice=5
fi
fi
fi
fi
done






3. Lalu save dengan menekan ctrl+X, dan Yes

4. Ketik chmod +x looping.sh

5. Buka tampilan outputnya dengan ketik
./looping.sh

No comments:

Post a Comment