[英]Differences between two .bashrc commands
I have this line of code : 我有这行代码:
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
Is there a difference between 两者之间有区别吗
eval "$(SHELL=/bin/sh lesspipe)"
and more simply 更简单
SHELL=/bin/sh lesspipe
(or export SHELL=/bin/sh lesspipe
) SHELL=/bin/sh lesspipe
(或export SHELL=/bin/sh lesspipe
) (What is the difference between using export
and not using it by the way?) (使用export
与不使用export
什么区别?)
Yes, there's a difference. 是的,有区别。
The second example just runs lesspipe
with the SHELL
variable set to /bin/sh
in its environment. 第二个示例仅在其环境中将SHELL
变量设置为/bin/sh
运行lesspipe
。
The first example does the same, but takes the output and runs that as a command in your current shell. 第一个示例执行相同的操作,但是获取输出并将其作为命令运行在当前shell中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.