Date: Sun, 24 Jul 2005 22:48:16 -0700 From: garys@opusnet.com (Gary W. Swearingen) To: Damian Gerow <dgerow@afflictions.org> Cc: questions@freebsd.org Subject: Re: Shell scripts, SSH sessions, and for loops, oh my! Message-ID: <q33bq3mo67.bq3@mail.opusnet.com> In-Reply-To: <20050725003238.GD2461@afflictions.org> (Damian Gerow's message of "Sun, 24 Jul 2005 20:32:38 -0400") References: <20050725003238.GD2461@afflictions.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Damian Gerow <dgerow@afflictions.org> writes: > I'm trying to write a shell script that runs a for loop in an SSH session. > Simply, I'm trying to do this: > > for HOST in `cat hostnames` ; do > ssh ${HOST} "for PROCESS in 01 02 ; do echo '${PROCESS}' ; done" > done > > But because this is run in a script, that gets translated to: > > for HOST in `cat hostnames` ; do > ssh ${HOST} "for PROCESS in 01 02 ; do echo '' ; done" > done Here's a few clues (assuming you really want the single quotes in there): echo "THIS is SHELL: '\$SHELL'" echo "THIS is SHELL: '"'$SHELL'"'" echo 'THIS is SHELL: '\''$SHELL'\' which all give THIS is SHELL: '$SHELL'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?q33bq3mo67.bq3>