Shell Program for KTP Data Input (SPKDI)



AVAILABLE:    5

This is one of the historical remnants of learning Linux during college, around the second semester. Basic logic programming always begins with simple case studies and uses a straightforward environment, none other than the command line. Everything revolves around the command line, terminal, and similar tools.

Program:

#!/bin/sh
#12131294.sh
#Resident Biodata (KTP)
#Replacement for attendance on 26/04/14

for i in $(ls); do
echo "--------------------------"
echo "--------------------------"
echo "1. Display Data"
echo "2. Input Data"
echo "3. Exit"
echo -n "Choice: "
read PILIH
case $PILIH in
1)
    echo "Displaying KTP Identity"
    echo "Name:" $nama
    echo "Place of Birth: " $tmptlhr
    echo "Date of Birth: "$tgllhr
    echo "Gender: "$jnisklamin
    echo "Blood Type: "$gol
    echo "Address: "$almt
    echo "Religion: "$agm
    echo "Marital Status: "$kwin
    echo "Occupation: "$job
    echo "Citizenship: "$wn
    ;;
2)
    echo "Input Resident Biodata"
    echo -n "Name: "
    read nama
    echo -n "Place of Birth: "
    read tmptlhr
    echo -n "Date of Birth: "
    read tgllhr
    echo -n "Gender: "
    read jnisklamin
    echo -n "Blood Type: "
    read gol
    echo -n "Address: "
    read almt
    echo -n "Religion: "
    read agm
    echo -n "Marital Status: "
    read kwin
    echo -n "Occupation: "
    read job
    echo -n "Citizenship: "
    read wn
    ;;
3)
    exit
    ;;
*)
    echo "Invalid choice!!"
    ;;
esac
done

Output:

Hopefully, this is useful, and happy learning!


Post a Comment

Previous Next

نموذج الاتصال