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

  • Home
  • SEARCH
  • 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 8987771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:52:17+00:00 2026-06-15T21:52:17+00:00

Below is a shell script for taking 2 input parameter values, asd#@#g#@#h#@#j@#@k candidateid which

  • 0

Below is a shell script for taking 2 input parameter values,

  1. asd#@#g#@#h#@#j@#@k

  2. candidateid

which gives us output as

string0 asd
string1 g
string2 h 
.
.
.

candidateid

.
.
.

(& then both parameters are used in Oracle queries)

Now the problem is that the above code fails when I try to pass 1st parameter with spaces.

eg: /TOM/Process Folders/System Drive/a.jpg

The above given location should be considered as 1st string.
If I give the above within Double Quotes, then it works fine.
But the above parameter that I am getting is without quotes.

#!/bin/bash
input=$1

input1=$2

IFS='#' read -a arr <<< "${input//#@#/#}"

for((i=0;i<${#arr[@]};i++))
do
        echo "String$i ${arr[i]}"
done

read passportphotos <<< "${arr[0]}"
read academiccertificates <<< "${arr[1]}"
read dateofbirth <<< "${arr[2]}"
read addressproof <<< "${arr[3]}"
read pancard <<< "${arr[4]}"
read pfnominationform <<< "${arr[5]}"
read gratuitynomination <<< "${arr[6]}"
read investmentdeclaration <<< "${arr[7]}"
read resignationletter <<< "${arr[8]}"
read acceptanceoffer <<< "${arr[9]}"
read acceptancecodeofconduct <<< "${arr[10]}"
read medicalnomination <<< "${arr[11]}"
read backgroungverification <<< "${arr[12]}"
read personaldataform <<< "${arr[13]}"

echo $passportphotos
echo $academiccertificates
echo $dateofbirth
echo $addressproof
echo $pancard
echo $pfnominationform
echo $gratuitynomination
echo $investmentdeclaration
echo $resignationletter
echo $acceptanceoffer
echo $acceptancecodeofconduct
echo $medicalnomination
echo $backgroungverification
echo $personaldataform

instant_client="/root/ora_client/instantclient_11_2"
view=`$instant_client/sqlplus -s HRUSER/HRUSER@TOMLWF <<EOF

set heading off

set feedback off

set lines 10000

set pagesize 10000


insert into EMPLOYEEDOCUMENTS VALUES ((SELECT EMPLOYEEID FROM EMPLOYEE WHERE CANDIDATEID='$input1'),'Resume','Doc','$passportphotos','Y','HR',(SELECT SYSDATE FROM DUAL),'HR',(SELECT SYSDATE FROM DUAL),'HR',(SELECT SYSDATE FROM DUAL));
`

echo $view
  • 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-15T21:52:18+00:00Added an answer on June 15, 2026 at 9:52 pm

    I guess you did not really have to post all of that code to say you’re in trouble with spaces in an argument.

    As a complement, in any programming language, it’s rather much more useful to use an array, or to map values into a container — using an associative array, in case of bash — than creating dozens of variables.

    Edit:

    I’m sorry; as pointed by Barmar, I misread the post, and I presented something that does really changes not the execution of your program. Fact is that, if the problem is with the command line argument, then you must include double quotes wrapping it; this is how the arguments are read.

    You can, though, read all the arguments into an array, and then change the IFS, just as you did. Pay attention to the fact that your arguments must be separated by something already known at hand, as well as in your usage of IFS='#'.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below shell script in which sql file is called which has
So I'm trying to execute a shell script which produces a lot of output(in
I have three shell script which I am running as below- sh -x script1.sh
I have below code in my shell script which will keep on sleeping if
i have unix shell script which is need to be run like below test_sh
This is my below shell script which I am using to query the hive
Below is my shell script from which I am running my Hive query. In
Below is my shell script which I am using to create a PIE Graph.
Below is my shell script from which I am trying to invoke few hive
I have a shell script testShell.sh which uses getopts as below: #!/bin/bash while getopts

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.