Question

(a) Write a shell script program to perform all Arithmetic Operations using Command line arguments.

15 Apr 2024
Answer :
Word Count : 259

Sure, I can guide you through creating a shell script that performs all arithmetic operations using command-line arguments. Here's a simple script that you can create:

```bash
#!/bin/bash

# Check if the number of arguments is correct
if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <num1> <operator> <num2>"
    exit 1
fi

num1=$1
operator=$2
num2=$3

# Perform arithmetic operations based on the operator
case $operator in
    +)
 

__________ ______ _____ _____ ______ __________ _____ _______ ________ ____.
__________ _________ ______ ___ ________ __________.
_______ _________ _______ _____ _____ ___ __________ ______ _________ _______ _____.
____ __________ __________ ___ __________.
______ ________ ________ ______ ____ ____ ____ _________ ___ ______.
_____ ___ __________ _____ ______ _______ ___ __________.
____ _______ ___ ____ __________ _________ ________ ___ _____ __________ ______ ____.
_________ _________ _______ _________ _______ ___ __________.
__________ ______ _________ _________ ___ _______ _______ ________.
_______ ____ ______ ___ __________ ________ ______ ___ ______ __________.
____ ____ _____ ___ ______ ______ ________ ___ __________ ___.
____ _____ _____ ______ _________ ____ ____ ____ _________.
___ ________ ______ ______ _________ __________ ___ _____ _________ ____ ___ _____.
_________ ______ __________ ______ _______ ________ _________ ___ ________ ________.
________ __________ ________ ____ ______ ________ ____.
________ ___ ____ __________ _________ ____ _____ ______ ______ ______.
________ ____ _____ ____ ___ ________ ___ _________ _______ ____ ______.
_______ __________ ___ ____ _______ ______ _____ ________ _____ ______ __________.
__________ ____ __________ ______ ______ _______ ___.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 204 2024 - (a) Write a shell script program to perform all Arithmetic Operations | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→