-   Linux - General (
-   -   executing multiple commands by ssh (

jpan 10-22-2004 02:54 PM

executing multiple commands by ssh
Hi, i'm writing a bash script so that i can
login into a machine by ssh AND run multiple commands on that
machine....anybody knows that??

what i know now is to run a single command like:
$ssh root@ip_address command1

but how to run multiple commands??

druuna 10-22-2004 03:12 PM

Is this what you want:

$ ssh root@your.ip "ls -l / | grep tmp ; echo 'A rather dumb example'"
drwxrwxrwt 3 root root 12288 Oct 22 21:05 tmp
A rather dumb example

It's not a very usable example, but it shows that it is possible to use a command (ls -l) pipe it to another program (grep) and prints a message (echo).

Hope this helps.

All times are GMT -5. The time now is 06:06 PM.