2012-05-05 20:35:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2013-01-20 19:05:01 +00:00
|
|
|
OTHERS="$(cat others.txt)"
|
2012-05-05 20:35:16 +00:00
|
|
|
|
|
|
|
cd src/java
|
|
|
|
|
|
|
|
for other in $OTHERS
|
|
|
|
do
|
2013-01-20 19:05:01 +00:00
|
|
|
if [ ! -f "$other" ]
|
2012-05-05 20:35:16 +00:00
|
|
|
then
|
2013-01-20 19:05:01 +00:00
|
|
|
dn=$(dirname "$other")
|
|
|
|
mkdir -p "$dn"
|
|
|
|
pushd "$dn"
|
2012-05-05 20:35:16 +00:00
|
|
|
curl -O "http://algs4.cs.princeton.edu/${other}"
|
2013-01-20 19:05:01 +00:00
|
|
|
chmod 444 "$(basename "$other")"
|
|
|
|
popd
|
2012-05-05 20:35:16 +00:00
|
|
|
fi
|
|
|
|
done
|