我想把这个脚本转换成鱼:https://github.com/masahide/OmniSSHAgent/blob/main/hack/ubuntu-bash.setup.sh
这是我到目前为止的进度:
set OMNISOCATCMD $HOME/omni-socat/omni-socat.exe
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
function __get_omnisocat
echo "Get omni-socat.exe"
curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip
-sLo omni-socat.zip
unzip -o omni-socat.zip -d (dirname $OMNISOCATCMD)
rm omni-socat.zip
end
function __get_socat
echo "Install socat"
sudo apt -y install socat
end
function setup_omnisocat
[[ -f $OMNISOCATCMD ]] || __get_omnisocat
[[ -f /usr/bin/socat ]] || __get_socat
ss -a | grep -q $SSH_AUTH_SOCK
[[ $status -ne 0 ]] || return
rm -f $SSH_AUTH_SOCK
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK; fork EXEC:"$OMNISOCATCMD"; nofork &) >/dev/null 2>&1
end
setup_omnisocat
应该完全转换,除了最后一个函数中的主命令替换:
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK; fork EXEC:"$OMNISOCATCMD"; nofork &) >/dev/null 2>&1
引发错误:
omni-socat/ubuntu-fish.setup.fish (line 27): Command substitutions not allowed
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK; fork EXEC:"$OMNISOCATCMD"; nofork &) >/dev/null 2>&1
^
from sourcing file omni-socat/ubuntu-fish.setup.fish
.: Error while reading file 'omni-socat/ubuntu-fish.setup.fish'
我不知道如何转换它。你能帮我吗?由于
找到正确的方法来转换它(感谢@masahide: https://github.com/masahide/OmniSSHAgent/issues/16#issuecomment-1107446991):
setsid nohup socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$HOME/omni-socat/omni-socat.exe" >/dev/null 2>&1 & disown