diff options
| -rw-r--r-- | EXAM.md | 6 | ||||
| -rwxr-xr-x | bin/greet | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -139,6 +139,12 @@ Some examples of IPC mechanisms are: cd "$(dirname "$0")/.." USER=${1} +# broadcast +for i in `grep $USER /etc/passwd | cut -d: -f1`; do + (echo 'hello' | write "$i") || true +done + +# or find a specific user if cat /etc/passwd | cut -d: -f1 | grep -E "^$USER"; then echo "hello" | write "$USER" else @@ -3,6 +3,12 @@ cd "$(dirname "$0")/.." USER=${1} +# broadcast +for i in `grep $USER /etc/passwd | cut -d: -f1`; do + (echo 'hello' | write "$i") || true +done + +# or find a specific user if cat /etc/passwd | cut -d: -f1 | grep -E "^$USER"; then echo "hello" | write "$USER" else |
