zsh-users
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Louis-David Mitterrand" <vindex@apartia.ch>, <zsh-users@sunsite.dk>
Subject: RE: samba winpopup script
Date: Wed, 4 Apr 2001 12:08:47 +0400	[thread overview]
Message-ID: <000601c0bcde$79d8d930$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <20010404095255.A6819@apartia.ch>

>
> 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


  reply	other threads:[~2001-04-04  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-04  7:52 Louis-David Mitterrand
2001-04-04  8:08 ` Andrej Borsenkow [this message]
2001-04-04 18:01   ` Louis-David Mitterrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000601c0bcde$79d8d930$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=vindex@apartia.ch \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).