Can't open perl script "./script.pl": Permission denied - perl

I get the error when trying to run a script. The script previously worked, but I edited one part of the code in Notepad++ (I change a ">" to a "<" ).
Any help would be appreciated! I was wondering whether it was a formatting issue after editing and saving in Notepad++ or if somehow my edit breaks the script.
(I'm using Ubuntu for Windows)
I've tried using sudo & sudo chmod a+x before the script, but this doesn't seem to help.

The error message indicates that perl is unable to read the contents of the file script.pl.
Since it is not clear who the script's owner is, you may give read permission to everyone using the following, sudo chmod a=rx path/to/script.pl.

Related

Have a problem with perl or fedora bash. my source is not recognized unless pre fixed with perl

I call the program myfoo.pl, my first line is #!/usr/bin/perl.
When run from command line myfoo.pl I get command not found.
again when run using perl myfoo.pl it runs and completes. Not all my perl programs have this problem some run just using (path)/source.pl I ran head -1 myfoo.pl and got a print of my first line. no indication of problems.
Looking at the limited information you gave, I would say you are probably missing permission executable on the file myfoo.pl. To which the solution is to do
chmod +x myfoo.pl
It could also be a path to binary problem, that the perl binary is not located in /usr/bin/perl. In which case you need to figure out where it is, with which perl or where perl.
I suppose it could also be that the file myfoo.pl is not in your current directory, which it needs to be. Because of path settings, you also may have to execute it with
$ ./myfoo.pl
Because . is part of your path variable.
It is impossible to say for sure, because you are not answering questions, however. So when you eventually get around to answering questions, we may have more answers.

second line on my system or python terminal now saying: “ -bash: zzzzz#: command not found“

I have been trying to pip install psycopg2 for some time now
I have just updated to python 3.7.4, before this problem started.
To set my path to a specific python version I used the code below.
nano .bash_profile
I thought that it would now be easy for my system to identify the path of the newly installed python, as to enable it to install psycopg2. Then the below started happening.
The second line of system terminal or python terminal is now always showing:
-bash: zzzzz#: command not found on my terminal
No matter what I type on my terminal, I am always getting command not found
This would mean you literally have "zzzzz" somewhere in the bash_profile. Bash is seeing "zzzzz" as just another command to run at startup like the rest of the profile script. As there is nothing in your PATH matching that string, bash reports the issue back to you.
Either remove the extra line from your .bash_profile. OR use a terribly wasteful work-around!
ln -s /bin/true /bin/zzzzz
This will create a symbolic link to the "true" binary (all it ever does is return true) from zzzzz. Now bash can find zzzzz and run it during start up, which does nothing. No more error and an absurd work around. You should fix the file.

Is there PostgreSQL profile file like .bash_profile

Everytime I enter PostgreSQL via Terminal (by "psql"), I have to run some certain meta commands, like "\pset null [null]".
So, is there any way to execute it automatically everytime I run "psql", just like the .bash_profile or .bashrc file in the bash shell?
As documented in man psql:
~/.psqlrc
Oh, finally I found a solution via the help information, edit my .bash_profile, add the line:
alias psql='psql --pset=null=[null]'
It works

install CPAN module

I have a problem when i want to install perl module
I make " cpan" to install cpan , but i get this "
Terminal does not support AddHistory.
Your configuration suggests that CPAN.pm should use a working
directory of
/home/cyrine/.cpan
Unfortunately we could not create the lock file
/home/cyrine/.cpan/.lock
due to permission problems.
Please make sure that the configuration variable
$CPAN::Config->{cpan_home}
points to a directory where you can write a .lock file. You can set
this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your
#INC path;
You don't seem to have a user configuration (MyConfig.pm) yet.
i make "y"
then i got this strange message :
mkdir /home/cyrine/.cpan/CPAN: Permission denied at /usr/share/perl/5.10/CPAN/Shell.pm >line 656
Any idea please?
Thank you
The immediate cause of this problem is that you don't have write permissions on /home/cyrine/.cpan. In my experience, this is most often the result of logging in as a normal user, then running cpan for the first time on that account in a su session, causing the CPAN configuration to be created in ~cyrine (because you have cyrine's environment), but owned by root (because su has given you root's permissions). Assuming that is the case, you should be able to resolve this my suing to root, running the command chown -R cyrine.cyrine /home/cyrine/.cpan and then running cpan as user cyrine.

How do I fix "Permission denied" when I try to run an external Perl script?

system("logscr.ply ");
The error I get is this:
Can't exec "logscr.ply": Permission denied at eal.ply line 3
Why am I getting the error, and how do I fix it?
Without knowing any more details, there could be a variety of reasons:
Your example code states you're trying to execute "logscr.ply ". The space character at the end might be parsed as part of the file name. This should yield a file-not-found error, though.
The protection bits for the called script might not allow for direct execution. Try chmod u+x logscr.ply from your command prompt.
The folder containing logscr.ply might not be accessible to you. Make sure you have both read and execute permission on it (try chmod u+r,u+x folder-name).
The called script might not recognize itself as a Perl script, try system("perl logscr.ply");.
There might be a file with the same name somewhere earlier in your $PATH. Use absolute paths in your call to prevent this (system("perl /some/path/logscr.ply");), don't rely on your $PATH variable.
What platform/OS is this?
Probably logscr.ply just does not have execute permissions set. On Linux/Unix e.g. you should do
chmod u+x logscr.ply
then try again.
Note: This assumes you are the owner of logscr.ply. If not, adjust accordingly.