- 不适用-t则报错如下
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
the input device is not a TTY
- 不适用 bash 报错如下:
1589 $ ssh -t dep -ic "alg php"
Warning: Identity file c not accessible: No such file or directory.
bash: alg: command not found
Connection to 47.94.195.121 closed.
ssh -t user@remote /bin/bash -ic 'your-alias-here'
ssh 命令选项: -t
: 强制分配伪终端。可以用来在远程机器上执行任意的 基于屏幕的程序,有时这非常有用。
bash shell 的选项:
-i :运行交互 shell,这样 shell 才能运行 bash 别名。
-c :要执行的命令取之于第一个非选项参数的命令字符串。若在命令字符串后面还有其他参数,这些参数会作为位置参数传递给命令,参数从 $0 开始。
总之,要运行一个名叫 ll 的 bash 别名,可以运行下面命令: ssh -t user@remote /bin/bash -ic 'your-alias-here'
可用的:ssh -t dep bash -ic dphp