Created
May 20, 2015 12:55
-
-
Save MDXDave/debf3e4e49ad331a6a9f to your computer and use it in GitHub Desktop.
Login-Skript (BS1 Praktikukm, Aufgabe 1)
This file contains 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
#! /usr/bin/sh | |
hour=`date +%H` | |
min=`date +%M` | |
space=$( du -sm ~| awk '{print $1}') | |
maxspace=250 | |
realname=`ypcat passwd | grep $USER | cut -d: -f5` | |
if [ $hour -lt 06 ] | |
then | |
echo "\033[1;37mGuten Morgen!" | |
elif [ $hour -lt 12 ] | |
then | |
echo "\033[1;37mGuten Tag!" | |
elif [ $hour -lt 17 ] | |
then | |
echo "\033[1;37mGuten Nachmittag!" | |
elif [ $hour -lt 22 ] | |
then | |
echo "\033[1;37mGuten Abend!" | |
else | |
echo "\033[1;37mGute Nacht!" | |
fi | |
echo "\033[0mAktueller Nutzername: \033[1;36m $USER" | |
echo "\033[0mRealer Name: \033[1;36m $realname" | |
echo "\033[0mAktuelle Uhrzeit: \033[1;36m ${hour}:${min} Uhr" | |
echo "\033[0mAktueller Speicherplatz: \033[1;36m $space MB" | |
echo "\033[0m" | |
if [ $space -gt $maxspace ] | |
then | |
echo "\033[1;31mDer Speicherplatz pberschreitet $maxspace MB!\033[0m" | |
else | |
freespace=$(($maxspace-$space)) | |
echo "\033[0;32mSie haben noch ca. $freespace MB Speicherplatz frei!\033[0m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment