LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-22-2004, 02:54 PM   #1
jpan
Member
 
Registered: Aug 2004
Distribution: Debian Libranet
Posts: 69

Rep: Reputation: 15
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??
 
Old 10-22-2004, 03:12 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
execute multiple ssh remote commands tom221 Linux - Newbie 2 01-28-2005 02:00 PM
executing shell commands in c++ true_atlantis Programming 2 10-01-2004 05:53 PM
remote ssh commands on multiple hosts evilchild Linux - Software 6 08-12-2004 11:48 PM
Executing commands in Konsole... meteotrade Linux - General 5 10-20-2003 07:34 PM
Executing commands on startup viciousfish Linux - General 5 06-28-2002 03:15 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration