I know this list was fast. The winner goes to Ramiro Santos with a response time of less that 5 minutes. try exec $1 (the first argument in the list) My opinion is that tehe message is comming from the command itself and not from the script. Cheers Ramiro Santos PS. Try http://www.shelldorado.com Also to Lieven Marchand [lieven.marchand@just.fgov.be] with the following response. If all you want to do is change the environment, consider using env env FOO=BAR PATH=/bin command Otherwise, end your script with an exec of the command (after having exported the changed environment). Thanks, I have changed the script to /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 ${*}" exec ${*} It works like a charm. > -----Original Message----- > From: Rierson Robert Civ OC-ALC/MASLA > Sent: Monday, August 25, 2003 7:40 AM > To: 'sunmanagers@sunmanagers.org' > Subject: Script question - How to execute command passed to script. > > 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/sunmanagersReceived on Mon Aug 25 08:59:12 2003
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:18 EST