Skip to content

Instantly share code, notes, and snippets.

@rwenz3l
Created July 6, 2015 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwenz3l/30e1720002ddb0f1e2f7 to your computer and use it in GitHub Desktop.
Save rwenz3l/30e1720002ddb0f1e2f7 to your computer and use it in GitHub Desktop.
Loesung zu Aufgabe 6-2
#!/bin/bash
if [ $# -eq 1 ]
then
INPUT="${1}"
else
echo "Keine Input Parameter gegeben"
exit
fi
for line in $(cat ${INPUT} | tail -n 9 | tr " " "-" | grep '[0-9]$'); do
matrikel=$(echo ${line} | cut -d "," -f 4)
name=$(echo ${line} | cut -d "," -f 1)
vorname=$(echo ${line} | cut -d "," -f 2)
folderName="${matrikel}.${name}.${vorname}"
if [[ ! -d ${folderName} ]]; then
mkdir ${folderName}
else
echo "ordner ${folderName} existiert schon"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment