[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax error with lone > or < as string in [ ] tests with -a or -o o
From: |
Greg Wooledge |
Subject: |
Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators |
Date: |
Mon, 15 Apr 2024 14:48:42 -0400 |
On Mon, Apr 15, 2024 at 08:13:23PM +0200, Emanuel Attila Czirai wrote:
> On Mon, Apr 15, 2024 at 7:56 PM Greg Wooledge <greg@wooledge.org> wrote:
> > Sounds like you've found a nontrivial bug in FreeBSD (in the adduser
> > script, not in sh). I hope this gets reported and fixed, and in any case,
> > good work and thank you.
> >
> It's nothing really,
>
> there's code in adduser that does this:
> [ -z ">" -a -z ">" ] && continue
> which errors like:
> [: -a: unexpected operator
> but the > are $passwordvars
And that's a bug. That code is wrong, and it should be written this way
instead:
[ -z "$var1" ] && [ -z "$var2" ] && continue