Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这行代码:
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
有没有区别
eval "$(SHELL=/bin/sh lesspipe)"
更简单
SHELL=/bin/sh lesspipe
export SHELL=/bin/sh lesspipe
export(顺便说一句,使用和不使用有什么区别?)
export
是的,有区别。
第二个示例只是在其环境lesspipe中将SHELL变量设置为运行。/bin/sh
lesspipe
SHELL
/bin/sh
第一个示例执行相同的操作,但获取输出并将其作为当前 shell 中的命令运行。