From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12588 invoked from network); 4 Apr 2001 07:53:15 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Apr 2001 07:53:15 -0000 Received: (qmail 7300 invoked by alias); 4 Apr 2001 07:52:59 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3792 Received: (qmail 7282 invoked from network); 4 Apr 2001 07:52:58 -0000 Date: Wed, 4 Apr 2001 09:52:56 +0200 From: Louis-David Mitterrand To: zsh-users@sunsite.dk Subject: samba winpopup script Message-ID: <20010404095255.A6819@apartia.ch> Mail-Followup-To: zsh-users@sunsite.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.17i 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 -- "God is a mathematician of very high order, and he used very advanced mathematics in constructing the universe." (Dirac)