Last active
October 18, 2017 01:18
-
-
Save aidenbenner/a341aa0cdca30f576f6cc2fe5958fde1 to your computer and use it in GitHub Desktop.
downloadAsgn.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# downloads george files creates directory and inserts userid at the top of file | |
# usage bash downloadAsgn.sh [assignment_number] | |
ASSIGNMENT_NUMBER=$1 | |
USER_ID="abenner" # Your user id here! | |
# pad with 0s | |
if [ $ASSIGNMENT_NUMBER -lt 10 ] | |
then | |
ASSIGNMENT_NUMBER=0$ASSIGNMENT_NUMBER | |
fi | |
MAX_QUESTION=10 | |
BASE_URL="https://www.student.cs.uwaterloo.ca/~se212/asn/a${ASSIGNMENT_NUMBER}grg/a${ASSIGNMENT_NUMBER}q" | |
for((x = 1; x <= $MAX_QUESTION; x++)) | |
do | |
if [ $x -lt 10 ] | |
then | |
URL="${BASE_URL}0${x}.grg" | |
else | |
URL="${BASE_URL}${x}.grg" | |
fi | |
wget $URL -P ./a$ASSIGNMENT_NUMBER | |
echo $URL | |
done | |
sed -i "1s/.*/#u $USER_ID/" ./a$ASSIGNMENT_NUMBER/*.grg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment