Last active
July 3, 2018 03:58
-
-
Save JIghtuse/021604bee56bddab6173c919da7dd2ad to your computer and use it in GitHub Desktop.
Installing the Programming Environment for Sedgewick's "Algorithms" on Linux
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 | |
# Based on http://algs4.cs.princeton.edu/linux/ | |
declare -r ALGS4_DIRECTORY=~/.local/algs4 | |
get_drjava() { | |
wget http://algs4.cs.princeton.edu/linux/drjava.jar | |
wget http://algs4.cs.princeton.edu/linux/drjava | |
chmod 700 drjava | |
mv drjava bin | |
} | |
get_libs() { | |
wget http://algs4.cs.princeton.edu/code/algs4.jar | |
wget http://algs4.cs.princeton.edu/linux/javac-algs4 | |
wget http://algs4.cs.princeton.edu/linux/java-algs4 | |
chmod 700 javac-algs4 java-algs4 | |
mv javac-algs4 bin | |
mv java-algs4 bin | |
} | |
get_checkers() { | |
wget http://algs4.cs.princeton.edu/linux/checkstyle.zip | |
wget http://algs4.cs.princeton.edu/linux/findbugs.zip | |
unzip checkstyle.zip | |
unzip findbugs.zip | |
wget http://algs4.cs.princeton.edu/linux/checkstyle.xml | |
wget http://algs4.cs.princeton.edu/linux/findbugs.xml | |
wget http://algs4.cs.princeton.edu/linux/checkstyle-algs4 | |
wget http://algs4.cs.princeton.edu/linux/findbugs-algs4 | |
chmod 700 checkstyle-algs4 findbugs-algs4 | |
mv checkstyle-algs4 bin | |
mv findbugs-algs4 bin | |
mv checkstyle.xml checkstyle-6.9 | |
mv findbugs.xml findbugs-3.0.1 | |
} | |
print_path_info() { | |
echo 'Add following line to ~/.bash_profile, ~/.profile, or ~/.bashrc:' | |
echo "export PATH=\$PATH:$ALGS4_DIRECTORY/bin" | |
} | |
mkdir "$ALGS4_DIRECTORY" | |
cd "$ALGS4_DIRECTORY" | |
mkdir bin | |
get_drjava | |
get_libs | |
get_checkers | |
print_path_info | |
sed -i "s|INSTALL=.*|INSTALL=$ALGS4_DIRECTORY|" "$ALGS4_DIRECTORY/bin/javac-algs4" | |
sed -i "s|INSTALL=.*|INSTALL=$ALGS4_DIRECTORY|" "$ALGS4_DIRECTORY/bin/java-algs4" | |
sed -i "s|INSTALL=.*|INSTALL=$ALGS4_DIRECTORY|" "$ALGS4_DIRECTORY/bin/checkstyle-algs4" | |
sed -i "s|INSTALL=.*|INSTALL=$ALGS4_DIRECTORY|" "$ALGS4_DIRECTORY/bin/findbugs-algs4" | |
sed -i "s|jar=.*|jar=$ALGS4_DIRECTORY/drjava.jar|" "$ALGS4_DIRECTORY/bin/drjava" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment