Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on CentOS 7. syntax error near unexpected token #24

Open
patsevanton opened this issue Jun 4, 2018 · 3 comments
Open

Error on CentOS 7. syntax error near unexpected token #24

patsevanton opened this issue Jun 4, 2018 · 3 comments

Comments

@patsevanton
Copy link

./postgresqltuner.pl
./postgresqltuner.pl: line 25: use: command not found
./postgresqltuner.pl: line 26: use: command not found
./postgresqltuner.pl: line 30: my: command not found
./postgresqltuner.pl: line 31: syntax error near unexpected token "Getopt::Long",{}' ./postgresqltuner.pl: line 31: $nmmc+=try_load("Getopt::Long",{});'

cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

yum install perl-DBD-Pg
Package perl-DBD-Pg-2.19.3-4.el7.x86_64 already installed and latest version
Nothing to do

perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

@Ruaphoc
Copy link

Ruaphoc commented Jun 4, 2018

To start, CentOS 7.3 is over a year out of date. In any case, the errors look like it is being parsed as a shell script, not as Perl... Try:

"perl ./postgresqltuner.pl"

See if the helps.

@patsevanton
Copy link
Author

patsevanton commented Jun 5, 2018

perl postgresqltuner.pl is work.
May be add to readme.md?

@mikelolasagasti
Copy link
Contributor

I was able to reproduce and I think you were missing shebang at the beginning of the file.

[root@pg8 ~]# head -n1 /bin/postgresqltuner

[root@pg8 ~]# /bin/postgresqltuner
/bin/postgresqltuner: line 22: use: command not found
/bin/postgresqltuner: line 23: use: command not found
/bin/postgresqltuner: line 24: use: command not found
/bin/postgresqltuner: line 26: my: command not found
/bin/postgresqltuner: line 27: -: command not found
/bin/postgresqltuner: line 28: -: command not found
/bin/postgresqltuner: line 29: -: command not found
/bin/postgresqltuner: line 33: my: command not found
/bin/postgresqltuner: line 34: syntax error near unexpected token `"Getopt::Long",{}'
/bin/postgresqltuner: line 34: `$nmmc+=try_load("Getopt::Long",{});'

With correct shebang:

[root@pg8 ~]# head -n1 /bin/postgresqltuner
#!/usr/bin/env perl
[root@pg8 ~]# /bin/postgresqltuner
postgresqltuner.pl version 1.0.1
(...)

So there is no need to add perl reference to readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants