Passing blanks in arguements

Passing blanks in arguements

Post by Alan Sengil » Tue, 16 May 1995 04:00:00



I have created a Bourne shell script that a user calls when they want to
execute a program. The shell script set-ups their enviroment and executes the
real program using an exec. A problem occurrs when they pass an argument in
quotes and it contains a space.

I had been running the real program in the script by using the following:


If the user types:

        scriptProgram arguement1 "arguement with a space"

The script executes

        exec realProgram arguement1 arguement with a space

That causes the realProgram to think that five arguements were pass instead of
two.

Does anyone know how to pass the second arguement with the spaces intact?

I tried having the script put "'s are the parameters, but that did not work
becuase the "'s were passed to the program.

            _________________
           |  ___  ________  |  Alan Sengillo
           | |  / /        | |  MRE/ESD/Integrating Technologies
           | | / /         | |  Eastman Kodak Company
           | |< < K o d a k| |  Rochester, NY 14562-4359
           | | \ \         | |  Phone: (716) 477-3492
           | |__\ \________| |  FAX:   (716) 722-6360

 
 
 

Passing blanks in arguements

Post by Prasad Deshpan » Tue, 16 May 1995 04:00:00



>I had been running the real program in the script by using the following:


You just have to change the above line to:


   This will protect the spaces from the shell but allow the interpretation

   Ofcourses, the users will have to say

       program "arguement with space"

Prasad Deshpande

 
 
 

Passing blanks in arguements

Post by Heiner Stev » Tue, 16 May 1995 04:00:00


 > I have created a Bourne shell script that a user calls when they want to
 > execute a program. The shell script set-ups their enviroment and executes the
 > real program using an exec. A problem occurrs when they pass an argument in
 > quotes and it contains a space.

 > I had been running the real program in the script by using the following:


You were almost correct:


Heiner
--

      -------------------------------------------------------------

    / BinTec Computersysteme GmbH / mine, not BinTec's --       /
   / Willstaetter Str. 30 -------   ...even if they should ;-) /

 ------------------------------------------------------------