我可以使用source
其他变量,除了PATH
# cd /data/local
# mkdir env
# vi env/dev
<esc>i
PATH=/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/bin:$PATH
CPLUS_INCLUDE_PATH=/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/include/c++/v1:$CPLUS_INCLUDE_PATH
LD_LIBRARY_PATH=/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/lib:$LD_LIBRARY_PATH
<esc>:wq
# source env/dev
# echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
# echo $CPLUS_INCLUDE_PATH
/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/include/c++/v1:
# echo $LD_LIBRARY_PATH
/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/lib:
我在 root Android
shell 中。
我可以$PATH
在终端中设置交互模式
PATH=/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/bin:$PATH
echo $PATH
/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
我能做到
which clang++
/data/local/workspace/clang+llvm-5.0.0-aarch64-linux-gnu/bin/clang++
但无法运行PATH
!中存在的可执行文件
# clang++
tmp-mksh: clang++: No such file or directory
# ./clang+llvm-5.0.0-aarch64-linux-gnu/bin/clang++
tmp-mksh: ./clang+llvm-5.0.0-aarch64-linux-gnu/bin/clang++: No such file or directory
PATH
这是评论中要求的十六进制转储
printf '%s\n' "$PATH" | hexdump -C
00000000 2f 73 62 69 6e 3a 2f 76 65 6e 64 6f 72 2f 62 69 |/sbin:/vendor/bi|
00000010 6e 3a 2f 73 79 73 74 65 6d 2f 73 62 69 6e 3a 2f |n:/system/sbin:/|
00000020 73 79 73 74 65 6d 2f 62 69 6e 3a 2f 73 79 73 74 |system/bin:/syst|
00000030 65 6d 2f 78 62 69 6e 0a |em/xbin.|
00000038