2
我时不时重复以下命令:我如何通过ssh直接登录到rails控制台?
ssh [email protected]
cd /projects/rails_project
bundle exec rails c production
我想创建一个shell脚本,使别名此文件的运行生产控制台一行。如果我用这3条命令写了简单的脚本,那么它就不起作用了。
我该怎么做?
我时不时重复以下命令:我如何通过ssh直接登录到rails控制台?
ssh [email protected]
cd /projects/rails_project
bundle exec rails c production
我想创建一个shell脚本,使别名此文件的运行生产控制台一行。如果我用这3条命令写了简单的脚本,那么它就不起作用了。
我该怎么做?
只需把它作为一个参数:
ssh [email protected] 'cd /projects/rails_project && bundle exec rails c production'
从man ssh
:
SYNOPSIS
ssh [options] [[email protected]]hostname [command]
...
If command is specified, it is executed on the remote host instead of a
login shell.
...
When the user's identity has been accepted by the server, the server
either executes the given command in a non-interactive session or, if no
command has been specified, logs into the machine and gives the user a
normal shell as an interactive session. All communication with the remote
command or shell will be automatically encrypted.
这么想的工作 SSH vgulaev @本地“坎德拉/家/ vgulaev /工作区/ insales_dev/insales && bundle exec rails' bash:bundle:找不到命令 –
'bash:bundle:command not found'你的服务器是否有ssh命令? – andlrc
whereis bundle bundle:/home/vgulaev/.rvm/gems/ruby-2.1.5/bin/bundle –