Question

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

13 Sep 2024
Answer :
Word Count : 474

To create a shell script that performs arithmetic operations using command line arguments in both Windows and Linux environments, you'll need to handle different syntax and scripting approaches. Here’s how you can do it for each:

### Linux Shell Script

In Linux, you can use a bash script to perform arithmetic operations. Save the following script in a file named `arithmetic.sh`:

```bash
#!/bin/bash

# Check if exactly 3 arguments are provided
if [ $# -ne 3 ]; then
  echo "Usage: $0 <number1> <operator> <number2>"
  exit 1
fi

___ ______ ________ _________ __________ _______ _________ ________.
_______ _____ ___ ______ _______ _____ ____ __________.
_________ ____ _______ _________ _________ _____ _______ ____ __________ _____ _________ _______.
___ ___ ________ __________ __________ ____ ____ ___ ___ ___ ___ ____.
__________ ___ ___ ____ _________ __________ _____ ___ ______ _______.
___ _________ ______ ___ ____ __________ ______.
_______ ________ ________ ________ _________ _________.
___ ________ ______ ______ ____ _______ ______.
_________ _______ __________ ______ _________ _________ _______ __________ ___ ____ ___.
_______ ____ ___ __________ _______ ________ ________ _____ ___ ________ __________.
___ ___ _____ _________ ________ _________ ________ ___ _________ ______.
______ ________ ___ _____ ___ ___ ______ _________ ___ ________ _____.
__________ ______ ________ ____ __________ _________ _______.
___ _______ ______ _________ _______ ______ _______ __________ ______ ________ ___.
_______ ___ ___ _____ ____ ____ _____ _________ _______ ____ _____.
_____ ____ ________ ____ _______ ________ ____ _________ ____ ___ _____ ____.
__________ ______ ____ ________ _____.
_______ ___ _________ _____ __________ ___ ___ _____ ___ _______ ___.
_________ ______ __________ _______ _______.
__________ _______ ____ _______ ___ _________ _____ _____ ____ ______ ________ _____.
___ _____ ___ __________ __________ ____.
_________ _____ ______ ________ __________ _____.
____ ___ ___ ____ _____ _________ _____.
_____ _____ __________ _______ _________ _______ ___.
____ ________ ______ _________ ___ ___.
_________ ______ __________ _____ _______ _______ __________ ________ _______ ________ _______ _________.
____ ________ __________ ____ ____ ___.
_______ __________ __________ ___ ________ ______ ________ __________.
_________ _______ __________ ______ __________ _____ ___ ________ ________.
______ ________ ______ __________ ______ _________ ____ _____ ___.
____ _________ _________ _______ __________.
_________ _____ ___ __________ ______ __________ ___ ____ ____ _______ ______.
________ __________ _________ ________ ____ _____ _____ ____.
________ _______ ____ __________ ____ ___ ___ ________.
_________ _________ ______ _____ _________ __________ ____ ____.
_________ ______ ________ ___ _______ ___ ______ ____ ___ ________ ________.
___ ________ ______ _________ _______ _________ _________ _____ _____ ______ ____ __________.
_______ ___ ___ ____ ________ ______ _____ _________ __________.
____ _____ ________ ___ ____ _______.
________ ___ ________ __________ __________ __________ _______ ______ _____ _____ _______ ____.
________ ___ _______ ______ ________ _______ _______ ________.
_______ _________ __________ _______ _________.
_______ ____ ___ _________ _______ ___ _____ ____ ____ ________.
________ ______ ______ __________.
Get Full Answer on WhatsApp
IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write a shell script program to perform all Arithmetic Operations usin
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→