Created
July 6, 2015 20:07
-
-
Save rwenz3l/30e1720002ddb0f1e2f7 to your computer and use it in GitHub Desktop.
Loesung zu Aufgabe 6-2
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 | |
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