running:
$ splunk cmd ../etc/apps/Splunk_TA_nix/bin/setup.sh
gives:
../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.
How can I run it successfuly?
Thanks!,when trying to configure the TA on an universal forwarder on HP UX 11.31, I gut the followin:
../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.
Any suggestion (other than updating all shell scripts) ?
Thanks!
ls -l /bin/sh
-r-xr-xr-x 2 bin bin 682408 Aug 26 2011 /bin/sh
There is no bash available on the system.
What about running a different command in that directory to test the shell. You should be able to run them directly from the CLI. I use user "splunk" and can run ps.sh:
sudo su - splunk
.../Splunk_TA_nix/bin/ps.sh
splunk cmd .../Splunk_TA_nix/bin/ps.sh
Both seem to provide the same output. You could also try running the script with a different shell, and see what that provides. I am not an expert in HP UX but it appears as though the shell provided does not like the "function" syntax. By default this TA uses /bin/sh as a shell. You could try running a different shell, but I know ksh has enough differences to cause some issues:
/bin/ksh .../Splunk_TA_nix/bin/ps.sh
/bin/csh .../Splunk_TA_nix/bin/ps.sh
(These could also be in /usr/bin/*sh)
I could be completely wrong here, but that is what it appears to be. I don't have an HP UX system to test.
Thanks but the problem is really the syntax of the "function".
I managed to run the script by removing all the "function" keywords (and adding open/close brackets where missing) as a definition of function should be one of:
function functname{
...
}
or
functname () {
...
}
(edit: post has been mixed)
running:
$ splunk cmd ../etc/apps/Splunk_TA_nix/bin/setup.sh
gives:
../etc/apps/Splunk_TA_nix/bin/setup.sh[18]: Syntax error at line 18 : `(' is not expected.
How can I run it successfuly?
Thanks!
Can you check the shell you are running:
On mine it is:
# ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Apr 24 12:47 /bin/sh -> bash