I'm trying to use a bash script for a study assignment. As a bash noob, I tried to adapt an existing one to suit my purpose: Compile/Make a C-program with different compile arguments, execute it and redirect its output to a file.
The script is as follows:
#!/bin/bash EXECUTABLE=./PartitionedHashJoin OUTFILE=results.txt for sizelog2 in $(seq 0 20) do for buckets in $(seq 2 2048) do size=$((1<<$sizelog2)) make clean make PartitionedHashJoin NUM_RELATION_R=$sizelog2 NUM_BUCKETS=$buckets echo -n $sizelog2 " " $buckets " " >> $OUTFILE $EXECUTABLE >> $OUTFILE done done
However, bash throws an error:
...: line 6: 11927 Illegal instruction: 4 $EXECUTABLE >> $OUTFILE
If I remove the redirecting of the executable's output, then it works.
I do not get what I could have typed wrong in the redirection - it works just fine in another example with just one loop. Google didn't have a suggestion so far for what I'm doing wrong.
Can anyone spot it?