0

I'm having a little trouble implementing a very simple shell script. I want to run a program with command line inputs 2-100 as one of the program arguments and direct the results to another file, i.e.

for (( c=2; c<101; c++))
do
   ./virtmem 100 $c fifo sort2 >> results/FIFOSORT.txt
done

But this doesn't quite work because it says fifo isn't a program. Any suggestions? Thanks for your help.

3
  • I would listen to it, if it thinks "fifo" isn't a program, then it thinks "fifo" isn't a program. That is, what happens if $c is replaced with a constant, say, 2 (which was said to be valid in another comment). I suspect it will be the same error making the variable usage a red-herring. Commented May 8, 2011 at 1:06
  • It would help if you pasted the exact output from the command line. This looks to me like an internal virtmem problem. Commented May 8, 2011 at 1:20
  • Thanks pst and bacchus, virtmem needed to be recompiled and the quotes needed to be around fifo and sort2. Neither one alone worked, thanks a ton. Commented May 8, 2011 at 1:40

2 Answers 2

1

What is virtmem doing with those args? If it's trying to run "fifo" as another script, perhaps fifo needs "chmod +x" to make it exec'able?

Sign up to request clarification or add additional context in comments.

1 Comment

Virtmem is a program that takes two integers and two strings as an argument. The first integer must always be 100, while the second must vary from 2-100 and the results must be recorded. Fifo and sort2 are just the last two arguments of the program, not other scripts. It's a virtual memory emulator with the first integer as the number of pages and the second as the number of frames. The two strings are the replacement algorithm and the test function.
0

Try to either do this

`./virtmem 100 $c fifo sort2 >> results/FIFOSORT.txt`

or this

./virtmem 100 $c "fifo" "sort2" >> results/FIFOSORT.txt.

I think it will solve your problem.

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.