This is impossible according to the POSIX standard. This is not a function of a specific shell, PATH handling is done within the execvp function in the C library. There is no provision for any kind of quoting.
This is the reason why including certain characters (anything not in the "portable filename character set" - colon is specifically called out as an example.) is strongly recommended against.
From SUSv7:
Since <colon>
is a separator in this context, directory names that might be used in PATH should not include a <colon>
character.
See also source of GLIBC execvp. We can see it uses the strchrnul
and memcpy
functions for processing the PATH components, with absolutely no provision for skipping over or unescaping any kind of escape character.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…