Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: samba winpopup script
- X-seq: zsh-users 3793
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Louis-David Mitterrand" <vindex@xxxxxxxxxx>, <zsh-users@xxxxxxxxxx>
- Subject: RE: samba winpopup script
- Date: Wed, 4 Apr 2001 12:08:47 +0400
- Importance: Normal
- In-reply-to: <20010404095255.A6819@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
>
> Hello,
>
> I am trying to build a script to notify all users on a LAN of network
> conditions through the winpopup protocol. To get all users connected to
> the samba server from which the winpopup messages will be sent I must
> parse smbstatus' output:
>
> Premier nobody nogroup 20067 sophia08
> (192.168.5.100) Mon Apr 2 17:34:43 2001
> Premier nobody nogroup 20079 dev03
> (192.168.0.136) Mon Apr 2 17:39:33 2001
> Premier nobody nogroup 20124 info09
> (192.168.0.221) Mon Apr 2 18:00:01 2001
> Premier nobody nogroup 7827 lnc_siege
> (192.168.0.70) Tue Mar 27 16:54:29 2001
> [etc.]
>
> And invoke:
>
> % echo $MESSAGE | smbclient -M $MACHINE -I $IP
>
> I started writing a script:
>
> MESSAGE="test"
> for i in `smbstatus | grep '(\w\+\.\w\+\.\w\+\.\w\+)' `; do
> echo $i | read SHARE USER GROUP MACHINE IP JUNK
> echo $MESSAGE | smbclient -M $MACHINE -I $IP
> done
>
> But $i contains each inidividual element of the smbstatus output, not
> each line. How could I capture each line into $i and the read the
> elements?
>
> Thanks in advance for your help, cheers,
>
> PS: I'd like the script to be compatible with /bin/sh ideally
>
Offhand - smbstatus definetely needs "no header" option like many others have.
smbstatus | grep '(\w\+\.\w\+\.\w\+\.\w\+)' | while read SHARE USER GROUP
MACHINE IP JUNK
do
... bla bla bla
done
-andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author