What’s the purpose of this script?
#!/bin/bash
file=contents.txt
users=`users`
if [[ -f $file ]]
then
for user in $users
do
allowed=`who -T| grep $user| tr -s " "| cut -d " " -f 2`
count=`who -T | grep $user | wc -l`
if [[ $count -gt 1 ]]
then
allowed=`who -T | grep $user | tr -s " "| cut -d " " -f 2| tail -n1`
if [[ $allowed == "+" ]]
then cat $file | write $user `who -T | grep $user | tr -s " " | cut -d " " -f 3| tail -n1`
else continue
fi
else
if [[ $allowed == "+" ]]
then cat $file | write $user
fi
fi
done
fi