Question

Write a shell program to illustrate the case statement. 

13 Sep 2024
Answer :
Word Count : 381

Here's a simple shell program that demonstrates the use of a `case` statement in both Windows (using PowerShell) and Linux (using Bash). This script will prompt the user to enter a number corresponding to a day of the week and then display the name of the day.

### Windows (PowerShell) Example

```powershell
# PowerShell script to illustrate the case statement

# Prompt user for input
$dayNumber = Read-Host "Enter a number between 1 and 7"

# Case statement to determine the day of the week
switch ($dayNumber) {
    1 { Write-Output "Monday" }
    2 { Write-Output "Tuesday" }
   

_________ ____ ________ _______ ___.
____ __________ ________ _________ _________ _________ __________ _____.
__________ _________ ______ ______ _______.
____ __________ ________ _____ ____ _________ ____ _____ _______.
_____ __________ _________ ___ ________ __________ ________ ____ _____ ______.
________ ____ _________ __________ ____ ______ _________ ______ ______ ______ ____.
_______ _______ ________ __________ ________ _________.
________ ___ _________ ____ _________ _________ _____ __________ ______.
___ _______ _______ _______ _________ ___ ___ _______.
_________ ________ _____ _____ ________.
________ _____ _________ _____ ____ _____ ___.
____ ______ ________ ____ ___ __________ ________.
________ _____ ____ __________ ________ __________ ________ ________.
______ ____ ___ _________ _________ _________ ________.
______ ______ ___ ______ _____.
__________ ________ ___ _______ ___ ___ __________ _______ _________ _______.
___ ______ __________ _____ ___ ______ ______ __________ _______.
___ _________ ______ _________ _________ _______ ___ ____ ____ ______ ______ ________.
___ ____ _________ ________ ________ ____ _______.
____ ________ _______ _____ _________ ___.
__________ __________ __________ ____ _________ ____ _________ _____ _______.
_______ _______ __________ ___ _____.
___ __________ ____ __________ __________ ___ __________ ______ _________ ________.
_____ _____ ___ _______ _______ __________ _________ ______ ______ __________.
________ ________ _______ __________ ______ ___ _____ ___ _________ _____.
_____ _________ ________ __________ ______ ___.
_____ __________ _________ ______ _____ ______.
_________ ________ _____ ____ ____ ______ __________ __________ ____.
_____ ____ _____ ________ __________ ____ _______ ________ ___ ______.
________ ____ _________ ____ _________ _________ _______ ______ ___ _______ _________ ____.
______ ______ ______ _______ ___ ____.
_______ _________ ______ _________ ______ ________ ____ ___ ___ _______ _________ _______.
_________ _______ _________ _________ ___ _________ ______ _________ _______.
_________ _________ __________.
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 - Write a shell program to illustrate the case statement.  | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→