oco*_*odo 45
除非您将 cygwin 用作多用户环境(在这种情况下chsh
,请像在标准环境下一样使用。)
否则,您只需将 cygwin.bat 更改为 runzsh -l -i
而不是,bash --login -i
它将作为登录 shell 运行。
当然,如果你想从启动时运行多个shell,只需创建一组.bat
文件来加载不同的shell。(sh
,ksh
,csh
,fish
等等)
我觉得我应该更新它以提供有关这样做的信息,chsh
但仍然在 Unix 端这样做。编辑/etc/passwd
文件并替换的出现/bin/bash
有/bin/zsh
。(这实际上是chsh
可以做的,但是这样您就可以一次性为所有用户执行此操作。)
小智 18
如果我没看错您的问题,那么您正在寻找的不是chere 提供的东西 (当然,这本身就很酷)。
Cygwin 的当前版本没有 /etc/passwd 文件,而且我正在使用的系统在域数据库中具有不受我控制的 Windows 帐户信息。因此, 不再支持chsh。
我还发现 bash 没有硬编码到 startxwin 脚本中,也没有硬编码到任何 .bat 文件中。事实证明,您根本不需要摆弄 .bat 文件。
搜索如何更改我的外壳,我发现了一些关于mkpasswd 的建议
我把它加到了混合物中。
手册页说:
Run Code Online (Sandbox Code Playgroud)SYNOPSIS mkpasswd [OPTIONS]... OPTIONS Don't use this command to generate a local /etc/passwd file, unless you really need one. See the Cygwin User's Guide for more information. -c,--current Print current user. DESCRIPTION The mkpasswd program can be used to create a /etc/passwd file. Cygwin doesn't need this file, because it reads user information from the Windows account databases, but you can add an /etc/passwd file, for instance if your machine is often dis? connected from its domain controller. Note that this information is static, in contrast to the informa? tion automatically gathered by Cygwin from the Windows account databases. If you change the user information on your system, you'll need to regenerate the passwd file for it to have the new information. For very simple needs, an entry for the current user can be cre? ated by using the option -c.
(我不知道为什么间距如此“关闭”......)
然后我使用了以下命令:
mkpasswd -c | sed -e 'sX/bashX/zshX' | tee -a /etc/passwd
下次打开 Cygwin 终端时,它将直接转到 zsh
我想,这就是你所要求的。
Jus*_*ser 17
我只是将bin
cygwin 目录中的目录添加到我的 Windows 路径环境变量中,然后创建一个快捷方式:
mintty.exe -i /Cygwin-Terminal.ico /bin/zsh --login
Run Code Online (Sandbox Code Playgroud)
或者只是将默认的 cygwin 开始菜单快捷方式更改为相同的。
小智 7
您可以编辑 /etc/nsswitch.conf,而不是创建一个 passwd 文件,Cygwin建议不要使用1。添加或编辑以下行:
db_shell: /usr/bin/zsh
这种方法的不利/有利方面是,如果您有多个用户,则此更改会影响所有用户。好的一面是它非常简单。唯一的问题是您必须重新启动 Cygwin。
如果您做此更改后使用mkpasswd,它会使用新的默认外壳为被允许登录的所有用户。
1 mkpasswd 文档是这样说的:
不要使用此命令生成本地 /etc/passwd 文件,除非您确实需要。有关更多信息,请参阅 Cygwin 用户指南。
我真的在用户指南中找不到任何可靠的推理,除了提到如果您的用户和组发生变化,您必须重新生成 /etc/passwd 和 /etc/group 文件,我认为这已经足够了原因。我可以说这个过程对于新手来说有点容易出错。
归档时间: |
|
查看次数: |
35455 次 |
最近记录: |