LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 05-30-2007, 02:36 PM   #1
arash8m
LQ Newbie
 
Registered: May 2007
Posts: 19

Rep: Reputation: 0
perl or shell question


Hi all,

I need to write a scripts that makes a connection with another linux server using ssh and reads the files in a directory and stores them into an array. Any ideas ?

Thanks,
 
Old 05-30-2007, 02:46 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Homework ?
 
Old 05-30-2007, 02:54 PM   #3
arash8m
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 0
no , part of task I'm working on these days.
 
Old 05-30-2007, 03:13 PM   #4
nc3b
Member
 
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
Consider using plink. It will only run a command on a server and get you the output. The you can split that output using whatever (awk for example, or cut but, I'm not sure you can do it with cut). Cheers.
By the way, you don't absolutely have to use plink, but, the way I see it, it might be the easiest way to get the output of a command that you run on a distant server.
 
Old 05-30-2007, 08:41 PM   #5
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 237Reputation: 237Reputation: 237
just an example:
Code:
#!/bin/sh
var=$(ssh someserver "ls /tmp")
for files in $var
do
    echo $files
done
 
  


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reinstall perl question.. (urpme perl) rjcrews Mandriva 2 01-28-2006 06:19 PM
shell and perl scripts srnerkar1 Programming 2 12-03-2005 03:07 PM
Shell Script, C, C++, or Perl ? mrpc_cambodia Programming 5 08-12-2004 10:18 AM
Hiding code in PERL, perl gui question randomx Programming 1 06-26-2004 03:22 PM
shell or perl? l_9_l Programming 8 05-10-2002 07:15 PM


All times are GMT -5. The time now is 06:38 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
Open Source Consulting | Domain Registration