I am using mac os x
, and I have some trouble setting the $PATH
env. If the directory name is /path/to/add/a:b/bin
, how can I add this directory to $PATH
which is separated by :
?
On Windows systems, files and directory names cannot be created with a colon (:). But if a file or directory name is created with a colon on a Linux or Mac operating system, then moved to a Windows system, percent encoding is used to include the colon in the name in the index.
It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon.
The : (colon) command is used when a command is needed, as in the then condition of an if command, but nothing is to be done by the command. This command simply yields an exit status of zero (success).
As far as I know, you can't. The obvious way to escape a :
character in $PATH
would be to use a backslash, but a quick experiment with Bash on Linux indicates that it doesn't work. OSX might behave differently, but I suspect you'd have the same problem.
Your best bet is to rename the directory. If it really needs to have that name, you can create a symbolic link and add that to your $PATH
:
$ cd /path/to/add
$ ln -s a:b a_b
$ PATH="$PATH:/path/to/add/a_b/bin"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With