Script question - How to execute command passed to script.

From: Rierson Robert Civ OC-ALC/MASLA (Robert.Rierson@tinker.af.mil)
Date: Mon Aug 25 2003 - 08:40:04 EDT


Security concerns aside for a minute.

Anyone know how to execute a command passed as an argument/parameter to a
script. I would like to create a massive wrapper script to setup/establish
user environments based on the command parameter passed and then execute
that command. Example - I have an application command

"dmgr -allowopenwin -menu libtest"

This would typically be executed at the command prompt. However, several
environment variables must be established, etc for this command to work
properly. So I wrote a wrapper script.

/usr/local/execute
#!/bin/csh
# This script takes command arguments, establishes environment for the user
and then executes the argument
#
# (Establish my environment here (Path, LD_LIBRARY_PATH etc.))

echo "Executing command ${argv}"
`${argv}`

That is what I would like to do, when I execute

/usr/local/execute dmgr

I get

`${argv}`: Ambiguous.

Any Idea's

I seem to have got it to work once but now I can't remember how I did it. It
seems fairly straight forward and simple. The echo statement works and I
know that argv is getting set to the "dmgr" string. Why won't the execution
take place on the `dmgr`.

Thanks for any reply's

Robert Rierson
robert.rierson@tinker.af.mil
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:58 EDT