OS Lab 04 Task 02

Pasted Oct 6, 2026, 4:42 AM1 file44 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/oslab04task02
untitled
#!/usr/bin/bash

# =========================================================
# Script: hello.sh
# Purpose: User Information System
# =========================================================

echo "=========================================="
echo "         USER INFORMATION SYSTEM          "
echo "=========================================="

# Prompting user for inputs using read -p
read -p "Enter Name: " name
read -p "Enter Father Name: " father_name
read -p "Enter Gender: " gender
read -p "Enter Phone Number: " phone_number
read -p "Enter Email ID: " email_id
read -p "Enter Degree Program: " degree_program
read -p "Enter Place of Birth: " place_of_birth
read -p "Enter Last Institution Studied: " last_institution
read -p "Enter Hobbies: " hobbies

# Output text file to store records
output_file="user_info.txt"

# Saving user details to the file
{
    echo "=========================================="
    echo "            STORED USER PROFILE           "
    echo "=========================================="
    echo "Name:                   $name"
    echo "Father Name:            $father_name"
    echo "Gender:                 $gender"
    echo "Phone Number:           $phone_number"
    echo "Email ID:               $email_id"
    echo "Degree Program:         $degree_program"
    echo "Place of Birth:         $place_of_birth"
    echo "Last Institution:       $last_institution"
    echo "Hobbies:                $hobbies"
    echo "=========================================="
} > "$output_file"

echo ""
echo "Information successfully saved to '$output_file'."

1,584 chars · codepastes.com