Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: samba winpopup script
- X-seq: zsh-users 3796
- From: Louis-David Mitterrand <vindex@xxxxxxxxxx>
- To: Andrej Borsenkow <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- Subject: Re: samba winpopup script
- Date: Wed, 4 Apr 2001 20:01:08 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <000601c0bcde$79d8d930$21c9ca95@xxxxxxxxxxxxxx>; from Andrej.Borsenkow@xxxxxxxxxxxxxx on Wed, Apr 04, 2001 at 12:08:47PM +0400
- Mail-followup-to: Andrej Borsenkow <Andrej.Borsenkow@xxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20010404095255.A6819@xxxxxxxxxx> <000601c0bcde$79d8d930$21c9ca95@xxxxxxxxxxxxxx>
On Wed, Apr 04, 2001 at 12:08:47PM +0400, Andrej Borsenkow wrote:
> > 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
On further consideration the script needs to weed out duplicates (users
that are connected to several samba shares):
(grep '(\w\+\.\w\+\.\w\+\.\w\+)' < smb.status |\
while read SHARE USER GROUP PID MACHINE IP JUNK
do
IP=${IP%%\)}
IP=${IP##\(}
echo $IP $USER $MACHINE
done) | sort | uniq | \
while read IP USER MACHINE
do
echo $IP $USER $MACHINE
bla bla bla ...
done
--
Your mouse has moved. Windows must be restarted for the change
to take effect. Reboot now?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author