#!/bin/sh # Teszt shellek: bash, ash, cash # zsh-val ment ugyan, de nem ugy, ahogy kellett volna... # ---------------------- last -a | sed -e "s/ \+/ /g" >feladatokhoz.tmp.last LAST=feladatokhoz.tmp.last user=$1 host="aszta" # pid = a program pid-je. atmeneti file-ok letrehozasahoz... pid=$$ days=`echo Mon Tue Wed Thu Fri Sat Sun | tr " " "\n"` # ---------------------- if test -z "$user"; then echo "Hasznalat:" echo " $0 [felhasznalo]" echo exit 1 fi # ---------------------- echo "Kiindulo adatfile letrehozasa..." grep "$user" $LAST | grep " $host" | cut -d " " -f "3 4 5 6 7 8 9 10" | sort >/tmp/feladat1.$pid.all.tmp # ---------------------- echo "Napi bontas keszitese..." for day in $days; do echo -n "$day " cat /tmp/feladat1.$pid.all.tmp | grep $day >/tmp/feladat1.$pid.$day.tmp done echo # ---------------------- for day in $days; do echo "$user '$day' napokon tortent bejelentkezesei:" echo cat /tmp/feladat1.$pid.$day.tmp echo "------------------------------------------------------------------------" done # ---------------------- rm -f /tmp/feladat1.$pid.all.tmp for day in $days; do echo -n rm -f /tmp/feladat1.$pid.$day.tmp done rm -f feladatokhoz.tmp.last