开发者

How to force ssh to execute bash instead of the user default on the remote machine?

I want to execute a bash script wit开发者_开发知识库h ssh but when I try this it's using ksh which is the user's default shell.

I can't change that default.

So, how can I trick ssh to execute my script with bash instead of the default shell?


Make this the first line of your script:

#!/usr/bin/env bash

Edit: As per this, the utility of /usr/bin/env is dubious. So, you probably want:

#!/bin/bash

Replace /bin/bash with the actual path of bash executable.


You can call your script explicitly with bash:

ssh <ssh-opts> bash <scriptname>

This way there will be a ksh executed at login, but inside ksh you start a bash executing your script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜