Thus spake Gary W. Swearingen ([EMAIL PROTECTED]) [25/07/05 02:13]:
: > 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'

Yeah, but...

The current shell still interprets $SHELL, and assigns it whatever local
value it has.  I don't want that.  I want $SHELL to be evaluated by the
remote system (the on to which I am establishing the SSH connection).

To answer my own question: it looks like sh just isn't the right tool for
the job.  I'm going to have to either completely change my approach to the
problem I'm trying to solve, or use Perl and Net::SSH (and given my problem,
I'm tending towards the latter).

  - Damian
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to