#!/bin/bash if [ $# -eq 0 ]; then echo "creates a *.tex file for the name and matrikel number given" echo "and fetches the folder name of the latest checked out project." echo "usage:" echo " $0 Student Name from List MATRIKEL_NO" exit 1 fi _args=( "$@" ) MATRIKEL_NR=${_args[-1]} unset _args[${#_args[@]}-1] PROJECT_PATH=$(ls -1t ../../ProjektArbeiten/ | head -1) NAME="${_args[@]}" FILE_NAME=${NAME//[ ]/_} FILE_NAME=bewertung-${FILE_NAME//[,]/}.tex cp -v bewertung-student.tex $FILE_NAME sed -i -e "s/StudentsName} {}/StudentsName} {$NAME}/" $FILE_NAME sed -i -e "s/Matrikel}\( \)* {}/Matrikel}\1 {$MATRIKEL_NR}/" $FILE_NAME sed -i -e "s/in_der_Praxis\//in_der_Praxis\/$PROJECT_PATH/" $FILE_NAME