Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to create a script to run simultaneously all the N64 Roms that I put inside a folder, reading the names from a text file.

Since now I did a script like this:

cat ./listN64_full.txt | while read line; do
    mupen64plus $line 
    echo "|"
done

The problem is that when the first emulated ROM is launched the script stops and I have to close the active window to run the second one.

How should I edit that script to load all them together?
The pipe seems doesn't work...

Thanks!!!

share|improve this question

1 Answer 1

Minimal modification to your script

#!/bin/bash
cat ./listN64_full.txt | while read -r line; do
  mupen64plus "$line" & 
  sleep 1   # Better to give a second or 2 to create the window 
  echo "|"  # It's here because so it was... 
done

When you execute a script is like if you write it line by line.
It's more safe to use read -r line instead of read line.

To execute a command in background you have to put the & at the end of the command line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.