有没有更好的方法在鱼壳中进行命令替换?
在bash中,我可以这样做:
~> echo $(whoami) => user
~> echo "I am: $(whoami)" = > I am: user
但在鱼类中看起来像我必须做的事情:
~> echo (whoami) => user
~> echo "I am: (whoami)" => "I am: (whoami)"
~> set who (whoami); echo "I am: $who" => I am: user
这是在fish中进行命令替换的推荐方法,其中替换需要在带引号的字符串中发生吗?
答案 0 :(得分:11)
你可以从引号中取出替换
echo "I am:" (whoami)