Bash Notebook Installations
echo "Using conditional statement to create a project directory and project"
# Variable section
export project_dir=$HOME/vscode # change vscode to different name to test git clone
export project=$project_dir/samuel # change APCSP to name of project from git clone
export project_repo="https://github.com/Samuelwaang/samuel" # change to project of choice
cd ~ # start in home directory
# Conditional block to make a project directory
if [ ! -d $project_dir ]
then
echo "Directory $project_dir does not exists... makinng directory $project_dir"
mkdir -p $project_dir
fi
echo "Directory $project_dir exists."
# Conditional block to git clone a project from project_repo
if [ ! -d $project ]
then
echo "Directory $project does not exists... cloning $project_repo"
cd $project_dir
git clone $project_repo
cd ~
fi
echo "Directory $project exists."
python2 --version
python3 --version
java --version
javac --version
jupyter kernelspec list
prints directory
cd $project
pwd
folders/files of directory
ls
folders/files of directory, including the hidden ones
list all files in long format
ls -al
lists files in a folder
cd $posts
pwd
ls -l
prints what's in the file
cat README.md
checks for python modules
test="python"
check=`conda list | grep $test`
n=${#check}
if [[ ${n} > 0 ]];
then
echo "$check"
else
echo "$test not found"
fi
Install java kernel if missing
test="java"
check=`jupyter kernelspec list | grep $test`
n=${#check}
if [[ ${n} > 0 ]];
then
echo "$test is already installed"
else
wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
unzip ijava-1.3.0.zip
python install.py
echo "$test has been installed"
fi
echo "pulling..."
git pull
echo "committing..."
git commit -a -m "New Commit"