将命令的输出存储在变量中

Store output of a command in a variable

在我的 mac 终端中,我试图将命令的输出存储到这样的变量中

$ animals=$(cat animals.txt | head -n $plusOne | tail -n $numberofanimals | sort -u | sed -E "s/[*#/@2]//g; s/D/d/g ; s/G/g/g ; s/E/e/g ; s/H/h/g ; s/O/o/g ; s/C/c/g ; s/[!]//g”)
> 

但它不起作用。当我按 Enter 时,我在下一行收到 > 提示。知道为什么吗?

您在行尾使用了智能引号 而不是常规的双引号 ".