与如何在 sh 的字符串中添加换行符是同样的问题 ? 但在鱼壳里。
在 bash 中我们有:
$'this is line\nthis is another line'
谁产生了预期的结果,但在鱼中这不起作用。
鱼有类似的方法吗?
编辑1:
faho 明智地提到了字面方法:
'this is line
this is another line'
\n
但我真的很好奇是否存在像 shell 中那样保留换行符引用的方法。
我想知道是否可以使用这个字符串"this is a line\nthis is another line"
来确保鱼将其视为\n
换行符而不是文字。