Unix Ques 3
Unix Ques 3
Unix Ques 3
Certainly! Here's a simple shell script that accepts two numbers from the user
and performs basic arithmetic operations:
#!/bin/bash
chmod +x arithmetic_operations.sh
The script will prompt you to enter two numbers, and it will perform addition,
subtraction, multiplication, division, and modulus operations on them,
displaying the results accordingly.
while true; do
# Display menu
echo "Menu:"
echo "1. List files in the current directory"
echo "2. Display the current date and time"
echo "3. Print the working directory"
echo "4. Exit"
# Accept choice from the user
read -p "Enter your choice (1-4): " choice
case $continue_choice in
[Nn]*)
echo "Exiting the script."
exit 0
;;
esac
done
This script allows the user to choose between listing files in the
current directory, displaying the current date and time, printing the
working directory, or exiting the script. After each operation, the user
is prompted to continue or exit.
#!/bin/bash
# Display menu
echo "Salary Calculation Menu:"
echo "1. Manager"
echo "2. Engineer"
echo "3. Intern"
echo "4. Exit"
#!/bin/bash