Re: Problem sending remote commands via SSH to remote host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02May2008 10:17, Rodrick Brown <rbrown@xxxxxxxxxxxxxxx> 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@xxxxxxxxxx> 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

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux