oliverlloyd / jmeter-ec2

Automates running Apache JMeter on Amazon EC2
GNU General Public License v3.0
464 stars 186 forks source link

(standard_in) 1: syntax error #86

Open Mat89189 opened 7 years ago

Mat89189 commented 7 years ago

Hi, I get this error:

Requesting 1 instance(s)...success

waiting for instance status checks to pass (this can take several minutes)...
(standard_in) 1: syntax error
./jmeter-ec2.sh: row 967: [: -gt: unary operator expected
[                                                  ] 0,00% - (0 of 1) - ^C

on this row in jmeter-ec2.sh file: if [ $(echo "$progressPercent>100" | bc) -gt 0 ]; then

oliverlloyd commented 7 years ago

Based on this, what if you use:

if [[ $(echo "$progressPercent>100" | bc) -gt 0 ]]; then

Does that solve it?

Also, in general, I'd be interested to see the command you used to run the script and any relevant (non sensitive) settings, like the properties file.

oliverlloyd commented 7 years ago

Better yet, this will check to make sure the var progressPercent has been set (it wasn't in your case).

if [[ -n "${progressPercent}" && $(echo "$progressPercent>100" | bc) -gt 0 ]]; then

Of course, the real issue is why this var wasn't set in the first place but the above will prevent errors when it's not and this is only some code to update the screen with progress so hopefully this doesn't affect overall execution of the script but I can't guarantee that.

oliverlloyd commented 7 years ago

I committed the extra checks above, if you're still seeing this error let me know (with the commands and settings you're using) and I can investigate further.

Mat89189 commented 7 years ago

Hi @oliverlloyd , thanks for support. I've modified the script according to your code. I got this error:

Requesting 1 instance(s)...success

waiting for instance status checks to pass (this can take several minutes)...
(standard_in) 1: syntax error
[                                                  ] 0,00% - (0 of 1) - (standard_in) 1: syntax error
[                                                  ] 0,00% - (0 of 1) \

Adding the code (set -x/+x) for debugging I got:

Requesting 1 instance(s)...success

waiting for instance status checks to pass (this can take several minutes)...
+ [[ -n 0,00 ]]
++ echo '0,00>100'
++ bc
(standard_in) 1: syntax error
+ [[ '' -gt 0 ]]
+ set +x
[                                                  ] 0,00% - (0 of 1) - + [[ -n 0,00 ]]

For launching I use this line: count="1" ./jmeter-ec2.sh

The property file jmeter-ec2.properties is (removed sensitive settings): https://justpaste.it/10wid

baranga commented 7 years ago

I experienced the same issue. Turned out the combination of my locale, printf and bc caused the trouble. My current locale is this:

$ env | grep LANG
LANG=de_DE.UTF-8

After changing to english the error disappeared:

$ LANG=en_US jmeter-ec2.sh