Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:21:08+00:00 2026-06-15T23:21:08+00:00

I need a shell script for the below. I have 14 variables as: scenario

  • 0

I need a shell script for the below.

I have 14 variables as:

scenario 1
input:

a#@#b#@#c#@#d#@#e#@#f#@#g#@#e#@#f#@#g#@#h#@#i#@#j#@#k#@#l#@#m#@#n

scenario 2
input:

a#@#b#@#c#@#d#@#e#@#f#@#g#@#e#@#f#@#g#@#h#@#i#@#j#@#k#@#l#@#m#@#n#@#

I want output as

op1 = a

op2 = b

op3 = c

op4 = d

op5 = e

op6 = g

op7 = f

op8 = h

op9 = i

op10 = j

op11 = k

op12 = l

op13 = m

op14 = n

Here op1 to op14 are variable in which i have to store the values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:21:10+00:00Added an answer on June 15, 2026 at 11:21 pm

    First replace #@# with a single, unique character delimiter e.g. #, then use read to read it into an array. The elements of the array contain the characters. This is shown below.

    $ input="a#@#b#@#c#@#d#@#e#@#f#@#g#@#e#@#f#@#g#@#h#@#i#@#j#@#k"
    $ IFS='#' read -a arr  <<< "${input//#@#/#}"
    $ echo ${arr[0]}
    a
    $ echo ${arr[1]}
    b
    $ echo ${arr[13]}
    k
    
    # print out the whole array
    $ for (( i=0; i<${#arr[@]}; i++ ))
    > do
    >     echo "Element at index $i is ${arr[i]}"
    > done
    Element at index 0 is a
    Element at index 1 is b
    Element at index 2 is c
    Element at index 3 is d
    Element at index 4 is e
    Element at index 5 is f
    Element at index 6 is g
    Element at index 7 is e
    Element at index 8 is f
    Element at index 9 is g
    Element at index 10 is h
    Element at index 11 is i
    Element at index 12 is j
    Element at index 13 is k
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have unix shell script which is need to be run like below test_sh
In shell script i need to redirect output from dd command to /dev/null -
I have three shell script which I am running as below- sh -x script1.sh
Problem Statement:- I have four shell script that I want to execute only when
I have below lines in my shell script. #!/bin/bash counter=0 counter=$((counter+1)) echo $counter And
I have the below command in my shell script to send all the four
I am exporting variables from shell script to awk. The program is below export
I'm need to create a Python shell script that refresh output every n seconds
I have table ,and i need access them from shell script and do the
i have a php file from which i need to call a shell script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.