From: "Win Toe ( Penguin Millennium )" Subject: Re: help with script Date: Thu, 19 Jul 2001 19:31:13 +0600 Sender: linux-admin-owner@vger.kernel.org Message-ID: <3.0.5.32.20010719193113.007cb4e0@myanmar.com.mm> References: <1055141806.1522.4.camel@alice> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: In-Reply-To: <1055141806.1522.4.camel@alice> List-Id: Content-Transfer-Encoding: 7bit To: pacho baratta , linux-admin@vger.kernel.org At 08:56 AM 6/9/2003 +0200, you wrote: > >i have a txt file with a list of username one by line, say: >user1 >user2 >user3 >..... > > >i'd like to avoid to insert all these users by hand (about 1000 users) >so i build a script to add users, make dirs and something useful to me > >my goal is to get a way to process txt file and send all users, one by >one, to my script. > >cat txtfile | ./script > >is processing only the 1st user, not the others. > >any idea to automatize this process? >tnx, pacho > while loop, $1 and shift can also do it. here is a sample scripts let us say u user list are in a file called, users. The following will be mail to all users in the list. Save this script, let us says, myscript. while [ $1 ] do mail `cat users` shift done If I want to use the above scripts to send mail to all users in the file, ./myscripts `cat users` pls replace the mail command name with your own scripts name Note:- You must use `cat users` with backquote ( not single quote )