我怎样才能让回声停止忽略鱼中的换行符

I how can I make echo stop ignoring line breaks in fish

我在做set catted (cat /home/blue/.ascii/whale.txt) && echo -e $catted

whale.txt的内容是:

\e[34m\e[5m       .\e[0m
\e[34m\e[5m      ":"\e[0m
\e[36m    ___\e[34m\e[5m:\e[0m\e[36m____     |"\/"|\e[0m
\e[36m  ,'        `.    \  /\e[0m
\e[36m  |  O        \___/  |\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m
\e[97m\e[44m~^~^~^~^~^~^~^~^~^~^~^~^~\e[0m

我需要保留换行符、显示颜色效果和显示整个文件。我怎么能用鱼做这个。因为我看过你需要echo -e "$(cat file.txt)"来显示换行符,但是fish不让你使用美元符号操作。

我愿意

for line in (cat ~/tmp/whale.txt); echo -e $line; end

fish 命令替换 return 行列表 ,因此使用 for 循环你 echo 处理每一行。

否则使用 sed 在文本中插入换行符:

echo -e (sed 's/$/\\n/' ~/tmp/whale.txt)