The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Include PERL script with in the unix shell script ganapati UNIX for Dummies Questions & Answers 1 04-29-2008 09:18 AM
How to include RETURN KEY with Background process "&" in Shell Script racbern Shell Programming and Scripting 1 03-11-2008 04:30 AM
how to include spreadsheet::ParseExcel in shell script akash Shell Programming and Scripting 1 01-10-2008 08:17 AM
Need help on C-shell script program haze21 Shell Programming and Scripting 1 11-14-2007 06:04 PM
shell script program jayaram_miryabb Filesystems, Disks and Memory 1 03-09-2005 05:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-12-2006
Registered User
 

Join Date: Sep 2005
Posts: 20
How to include shell script in C program

hi

I want to call a shell script in C program
the script is : ssh -t user@remote sh /<remote>home/user/<file_name>.sh
and other several commands

C program : Call this script and the retrive the task that is been done in <file_name>.sh file

can any one tell me how to call the script

thankx
Reply With Quote
Forum Sponsor
  #2  
Old 07-12-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 979
What do you mean by 'retrieve the task'?
Reply With Quote
  #3  
Old 07-12-2006
Registered User
 

Join Date: Sep 2005
Posts: 20
i am retriving some file that are generated by the shell script <which is running on remote machine> to my own machine from where i am executing the .c file
Reply With Quote
  #4  
Old 07-12-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
So have you been able to execute the script remotely yet? You can do it via the system() call. Try something like this:
Code:
system("ssh -t user@remote sh /<remote>home/user/<file_name>.sh");
system("scp user@remote:/path/to/remote_file /path/to/local_file");
If you are being allowed to use system(), then that's all that is there to it. If not, you will have to fork and exec.
Reply With Quote
  #5  
Old 07-13-2006
Registered User
 

Join Date: Sep 2005
Posts: 13
thanks it works
Reply With Quote
  #6  
Old 07-30-2006
Registered User
 

Join Date: Jul 2006
Posts: 1
thanks for the info....
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0