shin
shin

Reputation: 32721

What is the difference between $PATH and $fpath?

When I type echo $PATH and echo $FPATH I get different outputs. What are the differences between $PATH and $FPATH?

I use Mac OSX Mavericks.

Upvotes: 25

Views: 21435

Answers (3)

rob mayoff
rob mayoff

Reputation: 385500

All shells on Unix-like systems search PATH for an executable to run as a child process.

The Korn shell( ksh) searches FPATH for a file defining a shell function to load and execute in the current process.

The Z shell (zsh) searches fpath for a file defining a shell function to load and execute in the current process. See Autoloading Functions.

Upvotes: 4

Kirill Fuchs
Kirill Fuchs

Reputation: 13686

FPATH is the search path for function definitions.

FPATH The search path for function definitions. The directories in this path are searched for a file with the same name as the function or command when a function with the -u attribute is referenced and when a command is not found. If an executable file with the name of that command is found, then it is read and executed in the current environment. Unlike PATH, the current directory must be represented explicitly by . rather than by adjacent : characters or a beginning or ending :.

-- From the mac developer library

In addition to being used by ksh as @robmayoff noted in his answer. zsh also uses it.

Upvotes: 18

doptimusprime
doptimusprime

Reputation: 9395

Both are different environment variables and their value may not be same.

Also, see this link about environment variables

FPATH Contains a list of directories that the z/OS shell searches to find shell functions.

PATH Defines the default command path.

Upvotes: 1

Related Questions