Created
October 22, 2021 15:48
-
-
Save Haeniken/8afb0f0c4fad1c588e6295465eb95569 to your computer and use it in GitHub Desktop.
Messenger
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
#!/bin/bash | |
logged_on=$(who | grep -i -m 1 $1 | awk '{print $1}') | |
if [ -z $logged_on ] | |
then | |
echo "$1 is not logged on." | |
echo "Exit" | |
exit | |
fi | |
allowed=$(who -T | grep -i -m 1 $1 | awk '{print $2}') | |
if [ $allowed != "+" ] | |
then | |
echo "$1 does not allowing messaging." | |
echo "Exit" | |
exit | |
fi | |
if [ -z $2 ] | |
then | |
echo "No message parameter included." | |
echo "Exit" | |
exit | |
fi | |
# $ ./message.sh user this is long test message with using sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment