On Tue, Aug 12, 2003 at 01:35:53PM +0200, Fran?ois Chenais wrote:
> hello, 
> 
> I try to execute many command on a remote system through ssh but some of those 
> commands fails. What is THE way to execute many commands through ssh ?
> 
> 
> exemples
> -----------
> 
>  [1] ssh [EMAIL PROTECTED] "cat /etc/passwd | awk -F ':' '{ print $1; }'"
> 
>      ONLY prints empty lines

You're not quoting correctly. $1 is expanded within "" by the shell on
the *local* machine. Try this:

  echo "cat /etc/passwd | awk -F ':' '{ print $1; }'"

>  [2]     ssh [EMAIL PROTECTED] "(  \
>            uname -a; \
>          echo '<hr>'; \
>            fdisk -l; \
>          echo '<hr>'; \
>            ps auwxf; \
>          echo '<hr>'; \
>            find /users -type f \
>          echo '<hr>'; \
>          cat /etc/passwd; \
>          for name in `cat /etc/passwd | awk -F : '{ print $1}'`; do echo 
> '<b>'$name'<b><ul>';crontab -u name -l; echo '</ul>'; done; \
>          echo '<hr>'; \
>          )"

Ditto.

> the for name in ... command is executed by the local machine and not
> the remote one ???

Nope.

Cheers,

-- 
Colin Watson                                  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to