I've aliased ssh
to autossh -M0
for convenience, and it works well.
However it always exits in error, which causes problems with my scripts.
e.g.
ssh me@myserver 'true' # equivalent to: autossh -M0 me@myserver 'true'
echo $? # 1
How do I fix this?
(A workaround in scripts, it to use /usr/bin/ssh
instead of ssh
. But I'd like to fix this if possible.)
shopt -s expand_aliases; ssh myserver 'true'; echo $?
and now it gives0
! Thanks @αғsнιη! Maybe you could add as another answer? I guess both answers are correct for different reasons. – lonix Jun 21 '22 at 03:46