linux修改bash目录
How to test whether PATH has a specific directory in it in Bash on Linux?
如何在Linux上的 Bash中测试PATH是否在其中具有特定目录?
For example, how to test whether /usr/local/mytool/bin
is in $PATH
?
例如,如何测试/usr/local/mytool/bin
是否在$PATH
?
Directories in the $PATH
variable are separated by :
. So you can use a regular expression to test whether the $PATH
contains a directory.
$PATH
变量中的目录由:
分隔。 因此,您可以使用正则表达式来测试$PATH
是否包含目录。
The code for your specific example will be as follows (print true or false).
您