Question

(b) Write a shell script program to search whether element is present is in the list or not and also display its position in the list.

15 Apr 2024
Answer :
Word Count : 324

To create a shell script that searches for an element in a list and displays its position, you can follow these steps. Below, I'll provide a sample script implemented for both Windows (using PowerShell) and Linux (using Bash).

### Windows (PowerShell)

```powershell
# Define the list
$list = @(1, 3, 5, 7, 9, 11, 13, 15)

# Input element to search
$element = Read-Host "Enter element to search"

# Search for the element
$index = $list.IndexOf($element)

if ___ _________ _________ _______ _______ __________ __________ ______ ________ ___ ______.
_____ _____ ___ __________ ___ _________ ______ _____ ______.
_________ ___ ____ ______ ________ ________ ____ ________ _________ _______ ______.
_____ ______ _______ ____ _____ ______ __________ ___.
____ __________ ___ _________ __________ ________.
__________ ________ __________ _________ ______ ________ _____ ________ __________ _________ ____ _______.
_______ ___ _____ ________ __________ _____ _____ ______ _______ ___ ____ ________.
____ ___ _______ ______ _________ ______ ____ __________ _____ ___ ______ ______.
__________ _____ _________ _____ ____ __________ __________ ________ ________ ___.
__________ ___ _________ ________ __________ ___ _____.
_____ _______ _____ ________ ________.
________ _______ _____ _______ __________ ________ _________ ________ __________ _____ _________.
________ _________ ________ _______ _______ _________ _________ ______ _______.
______ ________ _____ ________ ___ _________ _____ _____ _________ _____.
__________ _____ ___ ____ ______ ______ ______ ___ _________ __________ _________.
______ _______ ____ ___ ____ ______.
_________ ______ ________ ____ _____ ___ _____ _____ ___ ____.
__________ _____ __________ __________ _________ _______ ____ ________.
________ ___ ____ ______ _________ ____ __________.
_________ ____ __________ ___ _____ _________ ____.
_____ ____ __________ ____ ____ _____ _____ ______.
_______ ___ __________ __________ ___ ______ __________ ______.
_____ _________ ______ __________ ______ ____ _______ ___ ________ __________.
__________ ___ ______ ___ ________ _____ ________ ____ _________ ___ ________ ______.
____ ______ ___ _______ ____ _______ ________ _______ ____ __________ _______.
_________ ________ ________ ________ _______ __________ ______ _____ _________ _____ __________ ____.
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 (b) Write a shell script program to search whether element is present
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support