Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between $PATH and $fpath?

Tags:

path

macos

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.

like image 832
shin Avatar asked Dec 08 '13 07:12

shin


3 Answers

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.

like image 166
Kirill Fuchs Avatar answered Oct 15 '22 22:10

Kirill Fuchs


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.

like image 27
rob mayoff Avatar answered Oct 15 '22 23:10

rob mayoff


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.

like image 1
doptimusprime Avatar answered Oct 15 '22 23:10

doptimusprime