$PATH和$fpath之间的区别是什么?

时间:2021-10-23 03:51:13

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

当我输入echo $PATH和echo $FPATH时,会得到不同的输出。$PATH和$FPATH的区别是什么?

I use Mac OSX Mavericks.

我用的是Mac OSX Mavericks。

3 个解决方案

#1


6  

FPATH is the search path for function definitions.

FPATH是函数定义的搜索路径。

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 :.

FPATH函数定义的搜索路径。当引用一个具有-u属性的函数并没有找到一个命令时,将搜索该路径中的目录,查找与函数或命令同名的文件。如果找到一个名称为该命令的可执行文件,则在当前环境中读取并执行该文件。与PATH不同,当前目录必须显式地表示为。而不是相邻的:字符或开头或结尾:。

-- From the mac developer library

——来自mac开发者库

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

除了被ksh使用之外,@robmayoff在他的回答中指出。zsh也使用它。

#2


1  

Lower-case fpath doesn't mean anything in any shell that I know of.

小写的fpath在我所知道的任何壳层中都没有任何意义。

Upper-case FPATH is used by ksh (the Korn shell) to find files that define shell functions, but it isn't used by bash, which is still the default shell on Mavericks as far as I know.

ksh (Korn shell)使用了大写的FPATH来查找定义shell函数的文件,但它并不是bash使用的,这是我所知道的在Mavericks上的默认shell。

#3


1  

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.

FPATH包含一个目录列表,该目录是z/OS shell搜索寻找shell函数的目录。

PATH Defines the default command path.

路径定义默认的命令路径。

#1


6  

FPATH is the search path for function definitions.

FPATH是函数定义的搜索路径。

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 :.

FPATH函数定义的搜索路径。当引用一个具有-u属性的函数并没有找到一个命令时,将搜索该路径中的目录,查找与函数或命令同名的文件。如果找到一个名称为该命令的可执行文件,则在当前环境中读取并执行该文件。与PATH不同,当前目录必须显式地表示为。而不是相邻的:字符或开头或结尾:。

-- From the mac developer library

——来自mac开发者库

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

除了被ksh使用之外,@robmayoff在他的回答中指出。zsh也使用它。

#2


1  

Lower-case fpath doesn't mean anything in any shell that I know of.

小写的fpath在我所知道的任何壳层中都没有任何意义。

Upper-case FPATH is used by ksh (the Korn shell) to find files that define shell functions, but it isn't used by bash, which is still the default shell on Mavericks as far as I know.

ksh (Korn shell)使用了大写的FPATH来查找定义shell函数的文件,但它并不是bash使用的,这是我所知道的在Mavericks上的默认shell。

#3


1  

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.

FPATH包含一个目录列表,该目录是z/OS shell搜索寻找shell函数的目录。

PATH Defines the default command path.

路径定义默认的命令路径。