diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-22 19:43:19 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-22 19:43:19 -0600 |
| commit | 0feb977a370d5985e4565f09639bcf3c393fbbc6 (patch) | |
| tree | bb53827ff3a7482fbbafb83be867afa28be32bc4 /EXAM.md | |
| parent | 04143a7e1307979ce0250f6de73d9612cfb95fc7 (diff) | |
implement an example the can broadcast to group of users
Diffstat (limited to 'EXAM.md')
| -rw-r--r-- | EXAM.md | 6 |
1 files changed, 6 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 |
