Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
sh is a shell-script, pl is a perl script. If the
linux machine doesn't support perl there's nothing
you can do to make the perl-script run. You can try
to re-write it in bash.
If the scripts contain that as the first line, they will be interpreted by perl when executed; they are probably actually perl scripts. While the .sh extension usually signifies sh shell scripts, if a perl script is named that way, the perl script will be executed.
Although it seems strange for the system to require .sh extensions,
you should be able to run your perl script as long as its first line is #!/usr/bin/perl
Indeed, the restriction on .sh extensions for executable programs is ridiculous.
Linux doesn't really care about file extensions (unlike Windows).
The fact that the system can run Perl scripts (since it has the necessary interpreter) under a "fake" file extension, proves that the restriction isn't effective.
To run the file from a cron job just add the command like what peter72 suggested into the cron file and the perl interpreter will run the script.
/usr/bin/perl /home/peter/bin/myspecialscript.pl
FYI
The #!/usr/bin/perl as the first line of a file is interpreted by the shell script interpreter (sh,bash,... that is prompting for a command) when the command is typed at the prompt. The file is then passed to the specified program (/usr/bin/perl in this case) to execute. You can use whatever command interpreter you need. This gives you the ability to mark a file as executable (chmod u+x ...) put it in the PATH and when you type that command at the prompt it will run.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.