Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<认证后执行命令> 如何执行多个命令? #2609

Open
zhongyi-peng opened this issue Dec 4, 2024 · 4 comments
Open

<认证后执行命令> 如何执行多个命令? #2609

zhongyi-peng opened this issue Dec 4, 2024 · 4 comments

Comments

@zhongyi-peng
Copy link

比如我登录后需要输入以下内容
ssh 1.2.3.4
1
su - hive
hive

要输入以上四行且带回车
在<认证后执行命令> 中用\n不生效
请问怎么实现

@fredme
Copy link

fredme commented Dec 11, 2024

just use "\n" at the end of command,like this:
su - hive\necho "something"

@zhongyi-peng
Copy link
Author

\n take no effect

@zhk0377
Copy link

zhk0377 commented Dec 23, 2024

比如我登录后需要输入以下内容 ssh 1.2.3.4 1 su - hive hive

要输入以上四行且带回车 在<认证后执行命令> 中用\n不生效 请问怎么实现

尝试输入一个命令可以正常执行的, 例如 sudo su \r 。但是多个命令还是无法执行

@fredme
Copy link

fredme commented Dec 23, 2024

在这里使用ssh命令不太合适,应该使用"ssh" - "代理"里面跳转服务器;
如果只是多个命令,"\n"是可以正常用的。比如"sudo su -\ncd /usr/local/src\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants