diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-22 19:37:48 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-22 19:37:48 -0600 |
| commit | 04143a7e1307979ce0250f6de73d9612cfb95fc7 (patch) | |
| tree | 838bbcda8f562c8bb967d6cbc33deaa62169ae25 /bin | |
| parent | dbe02b8de38c17fef21dd7d8dc0e78854e2b361c (diff) | |
write a shell script to send a message to a user on the machine
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/greet | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/greet b/bin/greet new file mode 100755 index 0000000..947958e --- /dev/null +++ b/bin/greet @@ -0,0 +1,11 @@ +#!/bin/sh + +cd "$(dirname "$0")/.." +USER=${1} + +if cat /etc/passwd | cut -d: -f1 | grep -E "^$USER"; then + echo "hello" | write "$USER" +else + echo "I could not find '${USER}'" + exit 1 +fi |
