Advertisement
cd62131

local maximums

Dec 15th, 2017
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. #!/bin/bash
  2. out='out.txt'
  3. # truncate
  4. : >${out}
  5. x1=0
  6. y1=0
  7. x2=0
  8. y2=0
  9. while read -r x y; do
  10.   if (( $(echo "${y1}<${y2}" | bc -l) &&
  11.         $(echo "${y2}>${y}" | bc -l) )) ; then
  12.     echo "${x2} ${y2}" >>${out}
  13.   fi
  14.   x1=${x2}
  15.   y1=${y2}
  16.   x2=${x}
  17.   y2=${y}
  18. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement