[ale] bash programming question...

Fulton Green ale at FultonGreen.com
Wed Jul 18 14:03:59 EDT 2001


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.





More information about the Ale mailing list