don't run curl if file exists

This commit is contained in:
David 2021-12-05 12:41:14 -05:00
parent 9136ba20af
commit c5dbac0e9c
1 changed files with 6 additions and 2 deletions

8
new.sh
View File

@ -6,6 +6,10 @@ if [ "${1}" != "" ]; then
padded=$(printf "%02g" ${1})
mkdir -p ${padded}/inputs
touch ${padded}/inputs/{input,testinput}
curl -s -H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${1##0}/input > "${padded}/inputs/input"
cp -n main.go.tmpl ${padded}/main.go
if [ ! -f "${padded}/inputs/input" ]; then
curl -s -H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${1##0}/input > "${padded}/inputs/input"
fi
if [ ! -f "${padded}/main.go" ]; then
cp -n main.go.tmpl ${padded}/main.go
fi
fi