How to pass >1 option on #! line in scripts?

How to pass >1 option on #! line in scripts?

Post by Stephen Egl » Tue, 14 Jan 1997 04:00:00



Hi,
Is it possible to emulate passing more than one option to an
interpreter on the first line of a script?
For example, I have the `atchange' script, and I want to do something
like:

#!/bin/atchange -s 2.0 -w 0.2
cmds
cmds
cmds

So that when I run this script, it runs the atchange program with the
given command line switches and then reads as input the cmds in the
rest of the file.  From what I've read,  shells only allow one option
switch to be passed.  Any hints?  (I normally use tcsh by the way.)

Cheers, Stephen Eglen

 
 
 

How to pass >1 option on #! line in scripts?

Post by Icarus Spar » Wed, 15 Jan 1997 04:00:00




>Is it possible to emulate passing more than one option to an
>interpreter on the first line of a script?

No. The best you can do is put in a wrapper to add the needed parameters.
"All problems in computing can be solved with another level of indirection"

Quote:>For example, I have the `atchange' script, and I want to do something
>like:

>#!/bin/atchange -s 2.0 -w 0.2
>cmds
>cmds

>So that when I run this script, it runs the atchange program with the
>given command line switches and then reads as input the cmds in the
>rest of the file.  From what I've read,  shells only allow one option
>switch to be passed.  Any hints?  (I normally use tcsh by the way.)

It is the kernel, not the shells,  which only passes one parameter.

 
 
 

How to pass >1 option on #! line in scripts?

Post by John R MacMill » Wed, 15 Jan 1997 04:00:00


|>Is it possible to emulate passing more than one option to an
|>interpreter on the first line of a script?
|
|No. The best you can do is put in a wrapper to add the needed parameters.
|"All problems in computing can be solved with another level of indirection"

Of course since many (all?) kernels don't allow the interpreter after #!
to be another script, you'll have to use a real executable as the
wrapper.  `Env'' will often suffice to kick start another script, but of
course since it's in /usr/bin on some systems, and /bin on others, and
#! doesn't allow $PATH lookups or environment variable substitutions,
you may have problems if it needs to run on multiple platforms.

Just another guy who thinks #! is a hack...

 
 
 

1. Passing option to bash script help needed

I need to be able to pass options to a script. A simple on/off will
be nice, the script will be use in a crontab to toggle connection to
the net.

Bash doesn't seem to accept it. I tried coping a script and still no go.

Cann someone help?

--
Grey Cloak

         ---------------------------------------------
  .###########.   Change spamtrap to grycloak, to email me.
 ##'___   ___`##   Wizard.FAQ v2.0 send blank Email to:

 ### ) | | ( ###    For other documents served

   #  ~!!!~  #    

http://www.geocities.com/Area51/7614
http://w3.one.net/~grycloak/dreams/dream.htm

2. XWindows display

3. Konsole and <ins> <del> keys

4. Oubtfuls questions on test199 (from Redbook)???

5. Chat line in script not passing to modem

6. Win95 and Partition Problem

7. How to pass reg exp as command line argument in shell script?

8. nvidia TwinView with CRT + TV

9. too many filenames to pass on a command line to a perl script

10. Chat line in script not passing to modem

11. Passing variables on the command line to a bash script

12. SED: Converting 5 line script into 1 line script

13. Passing argument containing <SPACE> in a script using 'sed'