0
#!/usr/bin/perl
$sim = "multiq";
`make SCHED=$sim`;
`script > scripter`;
`echo hi`;
print pack("c", 04);
~

This script hangs when script is called. Not sure how to get the perl script to keep running.

2
  • What happens if you port this code to a shell script? Commented Feb 12, 2010 at 19:55
  • print pack("c",04) ? Is that how you are trying to send ^D to the script? Commented Feb 12, 2010 at 19:56

4 Answers 4

5

Note that backticks (‘‘) run a command and return its output. If you're going to ignore the output, use system as in

system("make SCHED=$sim") == 0 or die "$0: make exited " . ($? >> 8)

If you want to fire-and-forget a program (that is, start it in the background without worrying about when it completes), you can use

system("script >scripter &");
Sign up to request clarification or add additional context in comments.

Comments

1

You're have to run that all in one child process if you want it to all interact. See the perlipc for various ways to handle that.

Comments

1

you might want to look at Expect to control an interactive session

Comments

0

backticks (‘‘) run a command and return its output.So you can store and manipulate it further. If you want to ignore the output, use system(). Also if you want to run any process in background use & in the prefix of the process. For example you wish to start Gimp using your script simply say

system("gimp &");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.