Sponsored Content
Full Discussion: ./ Why?
Top Forums UNIX for Dummies Questions & Answers ./ Why? Post 61010 by 98_1LE on Wednesday 26th of January 2005 08:38:03 PM
Old 01-26-2005
It has nothing at all to do with $HOME not being in $PATH, well unless the script is in $HOME.

UNIX uses an environment variable $PATH as a colon delimited list to define directories to be searched for commands entered into the shell. If $PATH is st to /usr/bin only, when you type ls, it looks in /usr/bin for something called ls, then tries to execute it. If ls is not in /usr/bin, it returns a file not found error.

Typically the path is set to a limited number of directories to make searches quick. If you want to exectute something not in a directory in $PATH, you have to specify the path to it. You can do this explicitely from root (example: /usr/bin/ls ), relative to where you are ( cd / ; usr/bin/ls ), or if it is in the directory you are in, with ./ ( cd /usr/bin ; ./ls ).

You may also use ./ if you want to use a specific version of a program. Say there are two ps commands, one in /usr/bin, the other in /usr/ucb/bin/ps. You want to use the latter, you can type the full path, or cd to /usr/ucb/bin, then run ./ps
 
ld(1B)						     SunOS/BSD Compatibility Package Commands						    ld(1B)

NAME
ld - link editor, dynamic link editor SYNOPSIS
/usr/ucb/ld [options] DESCRIPTION
/usr/ucb/ld is the link editor for the BSD Compatibility Package. /usr/ucb/ld is identical to /usr/ccs/bin/ld (see ld(1)) except that BSD libraries and routines are included before the base libraries and routines. OPTIONS
/usr/ucb/ld accepts the same options as /usr/ccs/bin/ld, with the following exceptions: -Ldir Add dir to the list of directories searched for libraries by /usr/ccs/bin/ld. Directories specified with this option are searched before /usr/ucblib and /usr/lib. -Y LU,dir Change the default directory used for finding libraries. Warning: This option may have unexpected results, and should not be used. FILES
/usr/lib /usr/lib/libx.a /usr/ucblib /usr/ucblib/libx.a ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
ar(1), as(1), cc(1B), ld(1), lorder(1), strip(1), tsort(1), attributes(5) SunOS 5.10 14 Sep 1992 ld(1B)
All times are GMT -4. The time now is 01:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy