golang-exercises/array-sorter/gen-numbers.sh

14 lines
305 B
Bash
Raw Normal View History

#!/bin/bash
2024-02-03 14:21:38 +01:00
FILE="./array-sorter"
echo {1..300} > ./numbers.txt
cat ./numbers.txt | tr ' ' "\\n" | shuf | tr "\\n" ' ' > ./random.txt
2024-02-03 14:21:38 +01:00
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 ./random.txt)