LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2005, 03:55 PM   #1
thanhVic
LQ Newbie
 
Registered: Jan 2005
Location: Canada
Distribution: Fedora3
Posts: 26

Rep: Reputation: 15
a perl question


I just write a perl script named First.pl. Everytime I run it, I need to type " perl First.pl" or
"./First.pl". My question is how to make my script become a command ?. E.x: I can type
" First.pl" to execute it.

Thank you,
 
Old 03-12-2005, 04:08 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this has nothing to do with perl whatsoever, and besides, it already IS executable. "./First.pl" means you are executing it directly. What you actually mean is how can i not have to type the "./" part... you would need to have the location of that directory in your path variable, however that is a REALLY bad idea... just don't. you type ./ first to specify it is in the current directory, and these conventions exist for good reasons. this file is 100% as executable as any other command on your system. don't break conventions unless you have a handful of genuine reasons, and "because you want to" really doesn't cut it... that's the way to bad habits and poorly managed systems.

Last edited by acid_kewpie; 03-12-2005 at 04:12 PM.
 
Old 03-12-2005, 05:04 PM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
You could always copy it to somewhere like /usr/local/bin and then you could run it as "First.pl".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl Question rjcrews Programming 15 12-12-2005 09:34 AM
perl question nooodles Programming 5 09-22-2005 02:01 AM
Hiding code in PERL, perl gui question randomx Programming 1 06-26-2004 03:22 PM
Perl Question cbarone Linux - Software 1 12-17-2003 10:25 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration