Maybe it's dumbest question in the world, but I seriously have problems with it and could use help. I am trying to run perl script on linux. It's a simple text editing script, nothing fancy. I googled for it and I found that I had to chmod +x
it and then just run myscript.pl
in the console. Since it's supposed to modify a text file I did myscript.pl > myfile.txt
after chmoding it
But it doesn't work. I get: bash: perl myscript.pl: command not found
Unless myscript.pl is in your path you will need to specify the current directory.
$ ./myscript.pl
You can check if the current directory is in your path with $ echo $PATH
. If you're frequently using this script you can put it in the path by moving it to a directory that's part of your path, usually ~/bin
.
Or by adding the current directory to the $PATH environment variable. Check the documentation for your shell for instructions.