如何在鱼壳的字符串中换行?

Iur*_*uda 8 string line-breaks fish

与如何在 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换行符而不是文字。

fah*_*aho 8

  1. Fish\n用换行符替换引号之外的内容,因此您可以停止并重新启动引号(注意引号前没有“$”):

'这是一行'\n'这是另一行'

  1. Fish 遵循跨行引号,因此您可以包含文字换行符:

'this is line this is another line'