[Solved] Run multiple commands in invoked program | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

[Solved] Run multiple commands in invoked program

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-03-2013
tz742 tz742 is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 3 February 2013, 9:55 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
[Solved] Run multiple commands in invoked program

Hi,
I have coded a program in Haskell using the compiler Hugs and the program requires multiple commands (with parameters) to be entered into it, it then outputs the result of its execution. I need to test a lot of different options (i.e. the parameters) so it would be obvious to automate the process. Using BASH I have managed to invoke the program and pass it a command, but only 1 command is executed and then the program closes.

How do I process sequential commands in the program from the script and then store the output of the execution, and then loop the process to test different parameters?

The program in question is invoked like this, followed by the commands, with the output following the last command:


Code:
$ hugs Net.hs
Net> command1 params
Net> command2 params
etc.
Net> lastcommand params
{output is displayed}

Thanks for your help.


EDIT:

I just worked out a solution, for anyone who has this similar problem here is my solution:


Code:
echo -e "command 1 params\ncommand2 params" | hugs Net.hs


Last edited by radoulov; 02-03-2013 at 04:05 PM.. Reason: Solution found
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run multiple commands cns1710 UNIX for Dummies Questions & Answers 5 03-28-2012 04:08 AM
Allow multiple users to run several root commands hedkandi SuSE 9 01-03-2012 10:07 PM
How to run two commands from a exec call in a c program suryashikha UNIX for Dummies Questions & Answers 3 10-30-2009 09:11 AM
Run multiple commands in $() without opening a new shell akar_naveen Shell Programming and Scripting 2 08-27-2009 05:12 PM
Command to run multiple commands from a file. kaixinsjtu UNIX for Dummies Questions & Answers 8 02-16-2009 01:16 AM



All times are GMT -4. The time now is 06:53 AM.