This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Perl: automatically search perl function from /usr/bin

Hey colleagues,

As the project goes on, numerous perl function were created and I would use them everyday. therefore, I put them into the /usr/bin directory. The problem is coming. Can I use them just like the way of ls, less or cat directly in any directory. I mean, How let linux (ubuntu) know I have put these perl code into the /usr/bin and so that I can use them as the following way in any directory, such as :

perl searchpdf.pl

I do not want to use the following way everyday.

perl /usr/bin/searchpdf.pl
perl

1. not a bioinformatics question

2. echo $PATH will tell you if "/usr/bin" is on your PATH (it generally is)

3. google for "linux path environment variable"

I am sure /usr/bin is on the PATH. but ​it doesn't work. that's my question. How to let the following works.

perl searchpdf.pl

That command is telling perl to look in the current directory for the script "searchpdf.pl" and this won't work of course because it isn't there. From the command line, you can find and run programs in your path if they are executable, but this will only work if the shell knows what to do with the file (hint: shebang line).

Yes, SES, you are quite right. two solution I have though: 1) compile perl code to executive binary files so that we can run it directly in command. 2) let linux more smart to search my file in PATH (not only binary executive file). What do you think?

Hello Shicheng Guo!

We believe that this post does not fit the main topic of this site.

Not a bioinformatics question. 1) Don't put things in /bin or /usr/bin. 2) search "shebang line" and file mode for executables. 3) Look up Perl's sitebin, or just extend your path.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.