Script question - How to execute command passed to script.
2007-12-25 1:52:00
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 at tinker.af.mil
Comments
Got something to say?
You must be logged in to post a comment.

