summaryrefslogtreecommitdiff
path: root/EXAM.md
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2019-10-22 19:43:19 -0600
committermo khan <mo.khan@gmail.com>2019-10-22 19:43:19 -0600
commit0feb977a370d5985e4565f09639bcf3c393fbbc6 (patch)
treebb53827ff3a7482fbbafb83be867afa28be32bc4 /EXAM.md
parent04143a7e1307979ce0250f6de73d9612cfb95fc7 (diff)
implement an example the can broadcast to group of users
Diffstat (limited to 'EXAM.md')
-rw-r--r--EXAM.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/EXAM.md b/EXAM.md
index f02f49a..bd7af87 100644
--- a/EXAM.md
+++ b/EXAM.md
@@ -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