Last active
October 18, 2017 13:15
-
-
Save jon-grangien/2badbdb6861bddbaf3b0cc015252d908 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
SHOWALL=false | |
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) | |
echo "scivis Very useful script for studying the course TNM067!" | |
echo "You need to download all the lectures and exercises first!" | |
echo "" | |
echo "scivis [-l lecturenumber]" | |
echo "" | |
echo "options:" | |
echo " -h, --help Brief help" | |
echo " -l, --lecture Open a lecture by number" | |
echo " -e, --exercise Open an exercise by keyword" | |
echo " -a, --all Show all lecture and exercise file names" | |
exit 0 | |
;; | |
-l|--lecture) | |
LECTURENUMBER="$2" | |
shift # past argument | |
;; | |
-e|--excercise) | |
EXERCISEKEYWORD="$2" | |
shift # past argument | |
;; | |
-a|--all) | |
SHOWALL=true | |
shift # past argument | |
;; | |
--default) | |
DEFAULT=YES | |
;; | |
*) | |
# unknown option | |
;; | |
esac | |
shift # past argument or value | |
done | |
if [ -n "$LECTURENUMBER" ]; then | |
zathura ~/Documents/courses/TNM067-vetvis/lectures/chap0$LECTURENUMBER* & | |
fi | |
if [ -n "$EXERCISEKEYWORD" ]; then | |
zathura ~/Documents/courses/TNM067-vetvis/exercises/**$EXERCISEKEYWORD** & | |
fi | |
if [ "$SHOWALL" = true ]; then | |
echo "/home/jonathan/Documents/courses/TNM067-vetvis/*" | |
echo "" | |
echo "Lectures" | |
for file in ~/Documents/courses/TNM067-vetvis/lectures/* | |
do | |
if [[ -f $file ]]; then | |
echo $file | cut -d'/' -f8-; | |
fi | |
done | |
echo ""; | |
echo "Exercises" | |
for file in ~/Documents/courses/TNM067-vetvis/exercises/* | |
do | |
if [[ -f $file ]]; then | |
echo $file | cut -d'/' -f8-; | |
fi | |
done | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment