我应该如何用破折号开始 bash?
How should I start bash with dash?
我在 ubuntu 服务器上工作,但我没有 root 权限。默认的 shell 是 dash
。
当我尝试更改默认 shell 时,它告诉我它没有权限。
user@host:~$ chsh -s "which zsh"
You may not change the shell for 'binjie'.
权限问题解决不了,所以我每次登录都转~/.profile
到运行bash,当我把echo something
加到~/.profile
,它被执行。但是当我将 exec -c bash
添加到 ~/.profile
时,在我通过 SSH 登录后 shell 丢失了响应。单击 Ctrl-C
后,连接关闭。我很困惑。有人可以帮忙吗?
好的,我在 dash 手册中找到了解决方案:
A login shell first reads commands from the files /etc/profile and .profile if they exist. If the environment variable ENV is set on entry to an interactive shell, or is set in the .profile of a login shell, the shell next reads commands from the file named in ENV. Therefore, a user should place commands that are to be executed only at login time in the .profile file, and commands that are executed for every interactive shell inside the ENV file. To set the ENV variable to some file, place the following line in your .profile of your home directory
ENV=$HOME/.shinit; export ENV
substituting for ''.shinit'' any filename you wish.
但是仍然有人可以向我解释为什么将 exec -c bash
直接添加到 .profile
不起作用吗?
我在 ubuntu 服务器上工作,但我没有 root 权限。默认的 shell 是 dash
。
当我尝试更改默认 shell 时,它告诉我它没有权限。
user@host:~$ chsh -s "which zsh"
You may not change the shell for 'binjie'.
权限问题解决不了,所以我每次登录都转~/.profile
到运行bash,当我把echo something
加到~/.profile
,它被执行。但是当我将 exec -c bash
添加到 ~/.profile
时,在我通过 SSH 登录后 shell 丢失了响应。单击 Ctrl-C
后,连接关闭。我很困惑。有人可以帮忙吗?
好的,我在 dash 手册中找到了解决方案:
A login shell first reads commands from the files /etc/profile and .profile if they exist. If the environment variable ENV is set on entry to an interactive shell, or is set in the .profile of a login shell, the shell next reads commands from the file named in ENV. Therefore, a user should place commands that are to be executed only at login time in the .profile file, and commands that are executed for every interactive shell inside the ENV file. To set the ENV variable to some file, place the following line in your .profile of your home directory
ENV=$HOME/.shinit; export ENV
substituting for ''.shinit'' any filename you wish.
但是仍然有人可以向我解释为什么将 exec -c bash
直接添加到 .profile
不起作用吗?