Subject: Re: string processing (was: text processing tool)
To: Lubos Vrbka <shnek@chemi.muni.cz>
From: David Laight <david@l8s.co.uk>
List: netbsd-help
Date: 03/13/2003 19:06:43
On Thu, Mar 13, 2003 at 07:49:43PM +0100, Lubos Vrbka wrote:
> thanks charles,
> the rs(1) seems to be the right choice for me! :o)
> 
> one more question - if i read empty string into a variable in a script 
> (/bin/ksh) (i.e. user just hits enter) and i want to test the variable, 
> i always get an error message (the same applies to space and probably 
> other white characters)

if [ "$variable" = "abc" ]

It is best to enclose almost all shell substitutions in "" - unless
you really need them to be split into tokens.
(IFS is used to control what is considered to be a separator.)

You will also see:
    if [ X"$variable" = X"abc" ]

Which makes absolutely sure you don't get a syntax error.

	David

-- 
David Laight: david@l8s.co.uk