Last active
February 29, 2016 03:11
-
-
Save kiyui/51b362bebd7c99569d00 to your computer and use it in GitHub Desktop.
javacc 5 install script
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/sh | |
# Installs javacc 5 | |
# My friends are just too lazy =,= | |
# Bash colors | |
txtblk='\e[0;30m' # Black - Regular | |
txtred='\e[0;31m' # Red | |
txtgrn='\e[0;32m' # Green | |
txtylw='\e[0;33m' # Yellow | |
txtblu='\e[0;34m' # Blue | |
txtpur='\e[0;35m' # Purple | |
txtcyn='\e[0;36m' # Cyan | |
txtwht='\e[0;37m' # White | |
txtrst='\e[0m' # Text Reset | |
echo -e "$txtpur""Preparing install""$txtrst" | |
if [[ ! -d ~/".local/share/bin" ]] | |
then | |
echo -e "$txtgrn""Creating ~/.local/share/bin""$txtrst" | |
mkdir ~/.local/share/bin | |
else | |
echo -e "$txtred""~/.local/share/bin exists.""$txtrst" | |
fi | |
if [[ $(echo $PATH | grep ~/.local/share/bin) ]] | |
then | |
echo -e "$txtred""~/.local/share/bin already in \$PATH""$txtrst" | |
else | |
echo -e "$txtred""Adding folder to \$PATH""$txtrst" | |
echo -e "$txtred""Please source ~/.bashrc or reopen bash""$txtrst" | |
echo "export PATH=~/.local/share/bin:"'$PATH' >> ~/.bashrc | |
echo -e "$txtred""If you use a shell other than bash, please do this manually!""$txtrst" | |
fi | |
# Prepare install | |
wget --header='Host: java.net' --header='Connection: keep-alive' 'https://java.net/downloads/javacc/javacc-5.0.tar.gz' -O 'javacc.tar.gz' -c | |
tar -xf javacc.tar.gz | |
if [[ ! -d ~/".local/share/javacc" ]] | |
then | |
mv javacc-5.0 ~/".local/share/javacc" | |
echo -e '#!/bin/sh'"\n""~/.local/share/javacc/bin/javacc "'$@' > ~/.local/share/bin/javacc | |
chmod +x ~/.local/share/bin/javacc | |
else | |
echo -e "$txtred""Please remove the previous version of javacc first.""$txtrst" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you have wget installed.