#!/bin/bash set -e [[ -z $1 ]] && echo target? && exit 1 target=$1 # strip to shortest name before the dot target=${target%%\.*} targetmd=$target.slides.md targetpdf=$target.slides.pdf resmd=$target.resources.md respdf=$target.resources.pdf function discount-ready { echo PUBLISHED LECTURE THERE IS! echo -n $targetpdf ... cp -f $targetpdf $HOME/discount/nethence/lectures/ && echo done echo -n $respdf ... cp -f $respdf $HOME/discount/nethence/lectures/ && echo done #echo eventually copy lab if there is #cp -vf labs/*.pdf $HOME/discount/nethence/lectures/ && echo done echo echo YOU MIGHT WANT TO RUN discountnh echo #cd ~/discount/ #./discountnh #echo } #[[:digit:]]{2}-[[:alnum:]-]+.md ls -F [0-9][0-9]-*.md cat [0-9][0-9]-*.md > $targetmd pandocslides.old.bash $targetmd echo -n "SLIDES: " grep -E '^# |^---' $targetmd | wc -l ls -F links*.md cat links*.md | sed -r 's@^([^#h$-].+)@\1 \\@' > $resmd pandocument.old.bash $resmd echo [[ -f $HOME/discount/nethence/lectures/$targetpdf ]] && discount-ready # https://stackoverflow.com/questions/15345936/regular-expression-usage-with-ls # https://unix.stackexchange.com/questions/44754/listing-with-ls-and-regular-expression