(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.
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 ($index -ge 0) {
Write-Host "Element found at position $($index + 1)"
} else {
_________ ______ __________ _________ _______ _______ ____ ____ ______ ________ __________.
____ ___ ________ _____ ________ ___ _________.
________ __________ _________ __________ __________ _____ _____ ____ ___ ________ ________.
____ ______ ______ _______ __________.
_________ _____ ___ _______ __________ ____ ______ __________ _______.
_____ _____ _______ __________ ___ ___ ____.
___ ___ ______ ____ _____ __________ __________ _________ _____ ________ _____.
___ _________ ______ ________ ___ _______.
____ ____ ________ _____ _______ ______ _________ ________ _____ _______ _____ _______.
______ ____ _________ ___ ________ __________ ______ _______ _______ ______ _______ _______.
___ ___ __________ ______ ______ ____ ____.
_________ ______ _______ ______ ____ ________ ___ _________ __________ ________ _________.
_________ __________ ____ ___ ______ _____ ____.
______ ______ _____ ______ ________ _____ _____ ___ _______ _______ _________ _____.
____ ________ _________ ______ ____ ___ __________ _____ _____ ___.
______ __________ ___ __________ ___ ___.
___ ________ ___ __________ _______ _________ ___ _____.
______ _____ ____ __________ __________ __________ _______ ___ _____ ____ ______.
_________ ____ _____ _____ ___ _______ ___ ______ ___ ______.
________ _______ ______ ________ ______ _____.
____ __________ ___ ________ __________ _______ ___ ______.
_________ ____ ___ ____ ___.
___ _________ _________ __________ _______ _________ _______ ___.
_____ __________ ______ _________ _______ ______ _______ __________ _______ ____ ____ _____.
_______ _________ __________ _______ _________ ______ _____ _____ _____.
__________ ______ _______.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required