0

I have a script, where there is a line:

eval for i in \{"$1".."$2"\}\; do [ ! -e "$3"/\$i.\* ] \&\& echo \"\$i\" \;  done \| shuf \| mycommand "$3"

which means: first create a sequence of numbers where no files named after the numbers exist, pipe them to shuf, and then pipe them to mycommand which is an ELF executable.

Most of time the script runs fine, but sometimes it gets segment fault error, i.e. The segment fault error is not reproducible.

$ myscript 0001 734  XMJ

/home/tim/bin/myscript: line 25: 10170 Exit 1                  for i in {0001..734};
do
    [ ! -e XMJ/$i.* ] && echo "$i";
done
     10171 Done                    | shuf
     10172 Segmentation fault      (core dumped) | mycommand XMJ

Does that mean that the segment fault is raised when running shuf?

What can we deduce from the error message and possibly correct it?

Thanks.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Tim
  • 101,790

0 Answers0