Case sederhana menggunakan Shell Programming


#!/bin/bash

echo “a = Menampilkan Daftar Pengguna”;
echo “b = Menjalankan pico/nano”;
echo “c = Menampilkan file /home/username”;
echo “d = Log Out”;

echo “Silahkan masukkan pilihan Anda:”;
read pilihan;

case $pilihan in
a) echo “Daftar pengguna: `who am i` ”
break
;;
b) pico testing.sh
break
;;
c) ls -l /home/wargalab/
break
;;
d) exit 0
break
;;

*) echo “yang Anda masukkan salah!”
break
;;

esac

hasil running program:

root@wargalab-AcerPower-S210:/home/wargalab/Documents/Alam/File Ujicoba# ./no2.sh
a = Menampilkan Daftar Pengguna
b = Menjalankan pico/nano
c = Menampilkan file /home/username
d = Log Out
Silahkan masukkan pilihan Anda:
c
total 2836
-rwxr-xr-x 1 wargalab wargalab     124 2010-11-04 10:54 1.sh
-rwxr-xr-x 1 wargalab wargalab      71 2010-11-04 10:11 5.sh
drwxr-xr-x 5 wargalab wargalab    4096 2010-11-03 21:59 Desktop
drwxr-xr-x 3 wargalab wargalab    4096 2010-11-03 17:03 Documents
drwxr-xr-x 5 wargalab wargalab    4096 2010-11-03 18:44 Downloads
-rw-r–r– 1 wargalab wargalab 2841899 2010-10-29 23:34 DSC09820.JPG
-rw-r–r– 1 wargalab wargalab     179 2010-10-14 04:03 examples.desktop
-rwxr-xr-x 1 wargalab wargalab     148 2010-11-03 17:31 moul3.sh
drwxr-xr-x 4 wargalab wargalab    4096 2010-11-03 18:26 Music
drwxr-xr-x 3 wargalab wargalab    4096 2010-11-02 19:52 Pictures
drwxr-xr-x 2 wargalab wargalab    4096 2010-10-14 04:18 Public
-rwxr-xr-x 1 wargalab wargalab      60 2010-10-26 12:05 tambah.sh
-rw-r–r– 1 wargalab wargalab     897 2010-10-27 17:44 tebakangka.c
drwxr-xr-x 2 wargalab wargalab    4096 2010-10-14 04:18 Templates
drwxrwxr-x 2 wargalab wargalab    4096 2010-10-23 14:42 Ubuntu One
drwxr-xr-x 2 wargalab wargalab    4096 2010-10-14 04:18 Videos

2 thoughts on “Case sederhana menggunakan Shell Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s