"Aaron Binns" <[EMAIL PROTECTED]> writes:

> I don't have any manuals handy for this one so I thought Id ask the list my
> newbie question.
> 
> I am writing a small shell script for work which reads in comma separated data
> and parses it to another program. I want to check each field to see if it is
> blank and if so exchange the blank for two single quotes (ie: '' ).
> 
> I am trying to use an if statement right now, but I cant figure out how to
> represent a blank.
> 
> if [ $field -eq "" ]
> then $do_something
> else $do_something_else
> fi
> 
> What's wrong with the above picture?
> 
> Aaron
> 

Try:

if [ x$field = x"" ]
then $do_something
else $do_something_else
fi

But try to use perl instead :)

-- 
:%s/[Ll]inux/GNU\/Linux/g



--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to