Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

[Solved] Run multiple commands in invoked program

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 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

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:

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

Thanks for your help.


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

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

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 03:08 AM
Allow multiple users to run several root commands hedkandi SuSE 9 01-03-2012 09: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 08:11 AM
Run multiple commands in $() without opening a new shell akar_naveen Shell Programming and Scripting 2 08-27-2009 04:12 PM
Command to run multiple commands from a file. kaixinsjtu UNIX for Dummies Questions & Answers 8 02-16-2009 12:16 AM

All times are GMT -4. The time now is 11:15 AM.