repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
make getpeername() return the original socket address which before it was intercepted
[hband-tools.git]
/
user-tools
/
msg
blob
52e6736ea0a42a1720f1b8352dfcd7cfe4ffe7ba
1
#!/bin/bash
2
3
true
<<EOF
4
=pod
5
6
=head1 NAME
7
8
msg - Write to given user's open terminals
9
10
=cut
11
12
EOF
13
14
15
mesg y
16
17
if
[ !
-z
"
$2
"
];
then
18
user
=
"
$1
"
19
shift
20
for
terminal
in
`who | grep -E "^
$user
\\
s" | awk '{print
$2
}'`
;
do
21
echo -e
"$*"
|
write
"
$user
"
"
$terminal
"
2
>/
dev
/
null
22
done
23
else
24
echo
"Use:
$0
<user> <message>"
>&
2
25
fi
26