MHMDhub / enterprise-log-search-and-archive

Automatically exported from code.google.com/p/enterprise-log-search-and-archive
0 stars 0 forks source link

/etc/init.d/syslog-ng: line 42: [: too many arguments #148

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Trying to stop syslog-ng with /etc/init.d/syslog-ng stop

What is the expected output? What do you see instead?
Expected: Stopping syslog-ng
Instead:  I've seen both of the following:
/etc/init.d/syslog-ng: 42: [: 1147: unexpected operator
/etc/init.d/syslog-ng: line 42: [: too many arguments 

What version of the product are you using? On what operating system?
r899

Please provide any additional information below.
I believe it is a quoting problem: bash, command substitution, and word 
splitting.
Putting quotes around the dollar sign command substitution on line 42 of 
/etc/init.d/syslog-ng:
FROM: $(pgrep -f elsa.pl)
TO:    "$(pgrep -f elsa.pl)"

Seems to solve the problem. 

http://www.xerxesb.com/2010/bash-too-many-arguments/
http://www.ibm.com/developerworks/library/l-bash2/#stringcompare
bash man page: "If the substitution appears within double quotes, word 
splitting and pathname expansion are not performed on the results."

Original issue reported on code.google.com by kebut...@gmail.com on 4 Jun 2013 at 5:13

GoogleCodeExporter commented 8 years ago
I've put quotes around that term, hopefully that fixes it.

Original comment by mchol...@gmail.com on 4 Jun 2013 at 4:56