Jumat, 11 Januari 2013

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. BlackBerry"
echo "2. Android"
echo "3. Iphone"
echo "4. Karwi"
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: BlackBerry"
else


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

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

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

echo "please make s choice between 1-4!"
echo "1. BlackBerry"
echo "2. Android"
echo "3. Iphone"
echo "4. Karwi"
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

Tidak ada komentar:

Posting Komentar

Virtual Coordinator Training Batch 2 Group 11 Bersama SEAMEO

Alhamdulillah pada kesempatan kali ini saya ingin sharing mengenai kegiatan VCT batch 2 yang telah saya lalui bersama para guru hebat lainny...