Problem sending remote commands via SSH to remote host
Cameron Simpson
cs at zip.com.au
Fri May 2 21:39:45 UTC 2008
On 02May2008 10:17, Rodrick Brown <rbrown at BallistaSec.com> wrote:
| I've written a script to startup a remote application and I'm running
| into issues when trying to run commands on the remote host.
|
| My script tries to execute the following
Missing line here?
| Here is a subset of my script
| #!/bin/bash
| host=somehost
| export APP_ARGS="-Darg1 -Darg2 -Darg3 -D${VAR1} -D${VAR2} "
| ${SSH_CMD} ${host} ""${APP_ARGS} -Dfoo=${host} -Dfoo=${host}
| com.packahe.AppClass >/dev/null &""
|
|
| If I use "" "" around ${APP_ARGS} my script backgrounds and works as
| stated but I get the following
|
| ./script.sh: line 46: : command not found every time yet everything
| works as designed
So.. _not_ as expected.
| If I use a single " " around ${APP_ARGS} the script runs sequentially
| and waits for each execution to finish before moving on I don't want
| this behavior but I don't get the following
You really need to learn how shell quoting works. Double quotes doesn't
do what you seem to think. This: "" is an start quote and then an end
quote.
1: Why export APP_ARGS? Almost certainly not necessary.
2: You seem very fond of curly brackets. Also usually not necessary and
IMHO harder to read.
3: What happens if you do this?
$SSH_CMD $host "$APP_ARGS -Dfoo=$host -Dfoo=$host com.packahe.AppClass >/dev/null &"
However it seems to me you have $APP_ARGS but no "$APP" to put in
front of it.
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
ASCII n s. [from the greek] Those people who, at certain times of the year,
have no shadow at noon; such are the inhabitatants of the torrid zone.
- 1837 copy of Johnson's Dictionary
More information about the redhat-list
mailing list