[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Using locally defined variable in ssh command line to remote host?
- Subject: [ale] Using locally defined variable in ssh command line to remote host?
- From: jknapka at kneuro.net (JK)
- Date: Thu, 09 Apr 2009 10:19:35 -0600
- In-reply-to: <[email protected]>
- References: <[email protected]>
Jeff Lightner wrote:
> Question:
>
> How can I create a variable in a script such that defining it on
> originating host allows me to feed it its value into the ssh command
> line on remote host?
>
>
>
> Details:
>
> I?m trying to do something like this:
>
>
>
> #!bin/bash
>
> REMSERVER=billybob
>
> REMLOGDIR=/felix/preprod/jboss/server/default/log
>
>
>
> ssh $REMSERVER 'sh -c "ls -tr ${REMLOGDIR}/webserver.log* |xargs grep
> -hA 10 DEBUG"'
Hmmm. Problem is, your variable is inside a single-quoted string, so it
isn't getting expanded on the local host. Is there a specific reason
you're not just saying
ssh $REMSERVER "ls -tr ${REMLOGDIR}/webserver.log* |xargs grep
-hA 10 DEBUG"
?
-- JK
--
A closed mouth gathers no feet.