Search code examples
sshfish

Fish shell new function : "ssh: command not found "


I'm trying to create a function that connects me to a ssh server then become su, and then ssh into another server so I did the following:

function test 
     ssh -t testuser@server1 'sudo ssh -t testuser@server2' 
end

When I execute it I get the following error ssh: command not found

But when I execute it straight to the terminal it works with no problems.


Solution

  • My problem was solved when I added each one of them to the fish functions folder:

    ~/.config/fish/functions

    I just created a file called myfunction.fish and inside of that file I pasted the function definition:

    function myfunction 
         ssh -t testuser@server1 'sudo ssh -t testuser@server2' 
    end
    

    saved it, exited fish and now that function is permanent.