将ECHO的结果存储在变量中而无需运行
我正在尝试创建一个称为$ spim
的变量,该变量是spim
的结果,但它运行spim
,这不是我的意图。
➜ 10 git:(main) ✗ echo "$(which spim)"
/usr/bin/spim
➜ 10 git:(main) ✗ $SPIM=$(echo "$(which spim)")
SPIM Version 8.0 of January 8, 2010
Copyright 1990-2010, James R. Larus.
All Rights Reserved.
See the file README for a full copyright notice.
Loaded: /usr/lib/spim/exceptions.s
(spim) exit
I am trying to create a variable called $SPIM
that holds the result of which spim
but it instead runs the spim
which is not my intention.
➜ 10 git:(main) ✗ echo "$(which spim)"
/usr/bin/spim
➜ 10 git:(main) ✗ $SPIM=$(echo "$(which spim)")
SPIM Version 8.0 of January 8, 2010
Copyright 1990-2010, James R. Larus.
All Rights Reserved.
See the file README for a full copyright notice.
Loaded: /usr/lib/spim/exceptions.s
(spim) exit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
bash
在这里运行没有问题(我没有安装spim
)。无需再次
echo
。Runs here with
bash
without problem (I do not havespim
installed).No need for
echo
again.