当前位置: 技术问答>linux和unix
shell 脚本自动登录执行命令
来源: 互联网 发布时间:2017-04-18
本文导语: 想写一个shell 脚本 自动 链接到一台机器上,输入那台机器的 用户名,密码。然后在执行一条命令 这个脚本怎么写。 | ssh username@ip-address "your command" | 主席的方法很好 ...
想写一个shell 脚本 自动 链接到一台机器上,输入那台机器的 用户名,密码。然后在执行一条命令
这个脚本怎么写。
这个脚本怎么写。
|
ssh username@ip-address "your command"
|
主席的方法很好 ,但是可能不是你想要的“很多命令”的效果吧,我这有个FTP 的小例子,希望对你有用
新建个.sh文件
#!/bin/sh
ftp -n user name password
binary
prompt off
lcd /home/
cd revfiles
ls
mget *.r
mdelete *.r
close
不知道你要的是类似效果不,意思你应该能看懂吧,看不懂再联系
新建个.sh文件
#!/bin/sh
ftp -n user name password
binary
prompt off
lcd /home/
cd revfiles
ls
mget *.r
mdelete *.r
close
不知道你要的是类似效果不,意思你应该能看懂吧,看不懂再联系