Sample Header Ad - 728x90

ssh/mosh to a remote interactive shell and run specific function

2 votes
2 answers
980 views
I have the following alias on my local machine: alias gom='mosh -- user@host "/path/to/specific/zsh"' I use it to connect to a remote machine with an interactive shell. I would like to **modify this alias** to run a specific function my_func defined in .zshenv **in the remote machine** as soon as I log in on it (when using this alias). How can I do so? I have tried the following: * alias gom='mosh -- user@host "/path/to/specific/zsh"; my_func;' * alias gom='mosh -- user@host "/path/to/specific/zsh; my_func"' * alias gom='mosh -- user@host "/path/to/specific/zsh & my_func"' Some of the above solutions disconnect me from the remote sessions, while others don't, but none of them work.
Asked by Amelio Vazquez-Reina (42851 rep)
Aug 31, 2015, 05:51 PM
Last activity: Apr 2, 2025, 03:44 PM