[bash.bashrc] Add reverse SSH script to bash.bashrc (#5438)
* [bash.bashrc] Add reverse SSH script to bash.bashrc * Fix command issue and add emptt line before EOF * Add checks for SSH_TARGET_CONSOLE_LINE Signed-off-by: Jing Kan jika@microsoft.com
This commit is contained in:
parent
e36c1fdb4d
commit
6a6e583b06
@ -56,3 +56,20 @@ fi
|
|||||||
|
|
||||||
# Automatically log out console ttyS* sessions after 15 minutes of inactivity
|
# Automatically log out console ttyS* sessions after 15 minutes of inactivity
|
||||||
tty | grep ttyS >/dev/null && TMOUT=900
|
tty | grep ttyS >/dev/null && TMOUT=900
|
||||||
|
|
||||||
|
# if SSH_TARGET_CONSOLE_LINE was set, attach to console line interactive cli directly
|
||||||
|
if [ -n "$SSH_TARGET_CONSOLE_LINE" ]; then
|
||||||
|
if [ $SSH_TARGET_CONSOLE_LINE -eq $SSH_TARGET_CONSOLE_LINE 2>/dev/null ]; then
|
||||||
|
# enter the interactive cli
|
||||||
|
connect line $SSH_TARGET_CONSOLE_LINE
|
||||||
|
|
||||||
|
# test exit code, 1 means the console switch feature not enabled
|
||||||
|
if [ $? -ne 1 ]; then
|
||||||
|
# exit after console session ended
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# exit directly when target console line variable is invalid
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user