[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#711162: ssh-copy-id "unexpected operator" error



Control: forwarded -1 https://bugzilla.mindrot.org/show_bug.cgi?id=2117
Control: tag -1 pending

On Wed, Jun 05, 2013 at 12:52:06PM +0600, Andrey Rahmatullin wrote:
> When running ssh-copy-id with or without arguments I get a shell error:
> 
> /usr/bin/ssh-copy-id: 168: [: 0: unexpected operator
> 
> The script continues working after this though. The offending code: "[ $# == 0
> ]". There is also "[ $# != 1 ]" in the next code block. POSIX test(1) doesn't
> know "==" and applies "!=" only to strings. Numbers should be compared with -eq
> and -ne.

Actually it's fine to do equality comparisons on numbers with = and !=,
just not (portably) with ==.  For purposes as simple as this, numbers
can be treated as strings.

I have forwarded your comment upstream, and fixed the non-portability
for my next upload.

Thanks,

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: