即使在使用脚本命令移动到其他shell之后也保持shell脚本运行,而无需从任何终端注销[重复]

时间:2022-07-07 22:22:38

This question already has an answer here:

这个问题在这里已有答案:

I have a script with one of its command let say "cmd" this cmd will move the user from the shell to some other server/shell , now when I run this script after executing "cmd" the shell gets changed (normal behaviour) but the commands following the "cmd" will not run and when I logout from the new terminal to come back to original one then only that commands execute on their own .

我有一个脚本,其中一个命令让我们说“cmd”这个cmd会将用户从shell移动到其他服务器/ shell,现在当我执行“cmd”后运行这个脚本时,shell会被更改(正常行为)但是“cmd”之后的命令不会运行,当我从新终端注销回到原始终端时,只有那些命令自己执行。

Is there any way so that the remaining will execute on the new terminal ?

有没有办法让其余的将在新终端上执行?

1 个解决方案

#1


-1  

I'm assuming your "cmd" is ssh opening a session on another server. If thats the case you can instruct ssh to run a command once the session is open: ssh user@server.com your_command_here

我假设您的“cmd”是ssh在另一台服务器上打开一个会话。如果是这种情况,您可以在会话打开后指示ssh运行命令:ssh user@server.com your_command_here

#1


-1  

I'm assuming your "cmd" is ssh opening a session on another server. If thats the case you can instruct ssh to run a command once the session is open: ssh user@server.com your_command_here

我假设您的“cmd”是ssh在另一台服务器上打开一个会话。如果是这种情况,您可以在会话打开后指示ssh运行命令:ssh user@server.com your_command_here