Re: nother bash question
On Mon 13 Jun 2016 at 10:19:46 (+0200), Thomas Schmitt wrote:
> Gene Heskett wrote:
> > if test ${InMail} = "gene"
> > bin/mailwatcher: line 66: test: =: unary operator expected
>
> The syntax problem is most probably about missing "-quotes around
> the variable ecaluation ${InMail} which would have to be empty to
> cause the message:
>
> $ test $notdefined = "hello world"
> -bash: test: =: unary operator expected
> $ test "$notdefined" = "hello world"
>
> $ defined=x
> $ test $defined = "hello world"
> $
>
> Another negative syntax effect would happen if ${InMail} did consist
> of more than one word:
>
> $ multiword="x y"
> $ test $multiword = "hello world"
> -bash: test: too many arguments
>
> (On the other hand, "gene" does not need its quotes because the
> text is a single constant word. "hello world" needs them, because
> of the blank on the middel.)
>
> -------------------------------------------------------------------
>
> Is ${InMail} supposed to be empty ?
> If not, then the script has another problem about properly setting
> the variable.
>
>
> Have a nice day :)
Thomas, your patience appears unbounded. We have been to this place before:
https://lists.debian.org/debian-user/2016/04/msg00652.html
Cheers,
David.
Reply to: