[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] bash programming question...
- Subject: [ale] bash programming question...
- From: ale at FultonGreen.com (Fulton Green)
- Date: Wed, 18 Jul 2001 11:03:59 -0700
Wrap the variable in double quotes, like "$i" and such.
On Wed, Jul 18, 2001 at 02:00:31PM -0400, Christopher Bergeron wrote:
> Does anyone know how I can [in bash] compare each line of a text file in a
> while loop in bash? For example:
>
> a file bands.txt contains:
> Nine Inch Nails
> Stabbing Westward
> Jimmy Buffet
>
> my script, ticketmastergrepper.sh contains:
> #!/bin/bash
> wget -q -O /tmp/ticketbastard.txt http://www.ticketmaster.com
> for i in 'cat bands.txt' do
> grep $i /tmp/ticketbastard.txt
> if [ $? -eq 0 ]
> then
> sendmail christopher at bergeron.com | echo "$i is onsale at ticketmaster!"
> fi
> done
>
>
> the problem I'm running into is with the spaces in the band names. for
> example when this runs, it greps for "Nine" instead of "Nine Inch Nails".
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.