用于在远程服务器上运行命令的 Fish 脚本

问题描述

如果我使用 sh 脚本,我会得到这个代码

ssh user@host <<-'ENDSSH'
    #command 1
    #command 2
ENDSSH

鱼的类似物是什么?

解决方法

fish 没有heredocs(见https://fishshell.com/docs/current/design.html

echo '#command 1
#command 2' | ssh user@host

set commands \
    "command 1" \
    "command 2"

printf "%s\n" $commands | ssh user@host