echo "Check if the necessary Jupyter Notebook Kernels are installed (Python3, Bash, & JavaScript)"
kernel_path=~/.local/share/jupyter/kernels
kernels=(python3 bash javascript)
kernel_count=0
cd ~
# Exit script if the kernel parent folder doesn't exist
if [[ ! -d $kernel_path ]]; then
echo "Jupyter Notebook not installed, unlucky"
exit 0
fi
# Iterate through all elements in kernels
for i in "${kernels[@]}"; do
# If the directory of the kernel exists, then increment kernel count by 1 and notify the user
if [[ -d $kernel_path/$i ]]; then
echo "$i kernel is installed."
let "kernel_count += 1"
else
echo "$i kernel is not installed."
fi
done
echo "Script Complete. You have $kernel_count/3 kernels installed."
echo "Check if user is properly signed into git"
cd ~
# Declare dictionary
declare -A settings=(["name"]="" ["email"]="")
# Store username & email in dictionary
echo -n "Enter your GitHub username: "
read settings["name"]
echo -n "Enter the email you use with GitHub: "
read settings["email"]
printf "\n"
# Iterate through all elements in dictionary
for key in "${!settings[@]}"; do
# grep the config file with the users name & email
grep_config=`cat ~/.gitconfig | grep ${settings[$key]}`
# If grep command doesn't find the name & email, set it using git config
if [[ ! ${#check_username} > 0 ]]; then
echo "Your git $key is not set to ${settings[$key]}!"
echo "Running git config --global user.$key ${settings[$key]} to set your name"
git config --global user.$key ${settings[$key]}
fi
echo "Your $key is set to ${settings[$key]}"
printf "\n"
done
echo "Script complete"