dak180 / FreeNAS-Report

SMART & ZPool Status Report for FreeNAS/TrueNAS
GNU General Public License v3.0
38 stars 8 forks source link

syntax error near unexpected token `(' #22

Closed TnTBass closed 1 year ago

TnTBass commented 1 year ago

Getting an error on TrueNAS-12.0-U8

./report.sh: line 1911: syntax error near unexpected token `('
./report.sh: line 1911: `                                       echo "Real Power: ${ups_realpowernominal}W (nominal)"'

I ran this manually with ./report.sh because the config file was not being created when it was setup via cron.

dak180 commented 1 year ago

@TnTBass does it work if you change the line to: echo "Real Power: ${ups_realpowernominal}W" '(nominal)'?

TnTBass commented 1 year ago

Different error now.

./report.sh: line 1931: syntax error near unexpected token `<'
./report.sh: line 1931: `       echo "<br><br>" >> "${logfile}"'
dak180 commented 1 year ago

Can you give me the output of the following ps -p "$$" type -aP bash and ls -l /bin/bash; also just to be sure you are not invoking the script though sh like sh ./report.sh.

Also try changing the line to echo '<br><br>' >> "${logfile}".

TnTBass commented 1 year ago
# ps -p "$$"
  PID TT  STAT    TIME COMMAND
58882  0  Ss   0:00.14 -csh (csh)
# type -aP bash
bash is /bin/bash
-aP: not found
# ls -l /bin/bash
lrwxr-xr-x  1 root  wheel  19 Mar 26  2022 /bin/bash -> /usr/local/bin/bash

Nope, not invoking through sh report.sh. Just ./report.sh.

# ./report.sh
./report.sh: line 1931: syntax error near unexpected token `<'
./report.sh: line 1931: `       echo "<br><br>" >> "${logfile}"'
TnTBass commented 1 year ago

New error changing that line.

# ./report.sh
./report.sh: line 2072: syntax error near unexpected token `('
./report.sh: line 2072: `                       echo "If you are on scale see https://ixsystems.atlassian.net/browse/NAS-115175 and https://github.com/dak180/FreeNAS-Report/pull/6#issuecomment-1422618352 for updates on when bc will be included in scale and how to add it in the meantime (this will need to be redone each upgrade)." >&2'
dak180 commented 1 year ago

@TnTBass does it work if you explicitly invoke it through bash: bash ./report.sh?

TnTBass commented 1 year ago

@dak180 - No, same error as above. I also get the same errors when it runs through cron.

dak180 commented 1 year ago

@TnTBass what does bash --version get you?

TnTBass commented 1 year ago

@dak180

# bash --version
GNU bash, version 5.0.16(0)-release (amd64-portbld-freebsd12.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
dak180 commented 1 year ago

@TnTBass how far does d78d46137a1 get you?

TnTBass commented 1 year ago

@dak180

Different error.

# ./report.sh
./report.sh: line 2336: unexpected EOF while looking for matching `"'
./report.sh: line 2338: syntax error: unexpected end of file
dak180 commented 1 year ago

@TnTBass are there any more errors after 0a026cf9e9882?

TnTBass commented 1 year ago

Script runs! Thanks!