Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 1998 09:18:42 +0200 (SAT)
From:      Reinier Bezuidenhout <rbezuide@oskar.nanoteq.co.za>
To:        tim@v-com.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: perl scripts to commands?
Message-ID:  <199803050719.JAA05329@oskar.nanoteq.co.za>
In-Reply-To: <2.2.32.19980305062210.006e45ec@v-com.com> from "tim@v-com.com" at "Mar 4, 98 10:22:10 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Hi ...

> 
> And of course when I try to execute it, I get "Command not found"
> 
> Somebody responded to one of the other e-mail questions I browsed and said
> to try "./" before the perl script command. 
> 
> It works, but why do I have to do it?
> 

Hi .. in your shell you have a PATH enviroment (the DOS PATH works about
the same :) ) ... when you try to execute a command, it "searches" the
path to try and find the file you are trying to execute.  If the directory
in which you are at that moment is not in the path, it won't find the 
executable.

If you use tcsh .. do a  
printenv PATH

to see what your path looks like.

You basically have three options ...

1. move the executable to a directory in your path
2. make a "bin" directory in your home directory, add that to your path
   int your start-up . scripts AND move the executable to that directory
3. Add ./ to your path - if you do this, it wil always also look in the
   directory you are currently in to execute a command HOWEVER - always add
   this to the end of your path (if you want to do this) as some people
   often place files like "ls" in their home directories that isn't
   really a ls but do all kinds of cute things to your file permissions :)

Personally I prefer 2 :)

Hope this explains it ... if I didn't say anything wrong :)

Reinier

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803050719.JAA05329>