array-sorter/gen-numbers.sh

14 lines
317 B
Bash
Raw Permalink Normal View History

#!/bin/bash
FILE="./array-sorter"
echo {1..300} > /tmp/numbers.txt
cat /tmp/numbers.txt | tr ' ' "\\n" | shuf | tr "\\n" ' ' > /tmp/random.txt
if test -f ./array-sorter; then
echo "$FILE exists, running"
else
echo "$FILE doesn't exist, building"
go build -o $FILE .
fi
./array-sorter $(cat /tmp/random.txt)