shell - 在 Cygwin 中设置默认 Shell

标签 shell cygwin fish

我已经使用 Cygwin 有一段时间了。我现在想从 bash 切换到 fish 。每个人都说你应该使用chsh -s /usr/bin/fish ,但出于某种原因,chsh对我不起作用。试图修改我的 Cygwin.bat文件也不起作用,更改我的 /etc/passwd 也不起作用文件。

我真的不明白这是怎么回事。有人可以帮助我吗?

最佳答案

尝试编辑/etc/nsswitch.conf 而不是/etc/passwd
而不是创建一个 passwd 文件,Cygwin recommends against 1、您可以edit /etc/nsswitch.conf .添加或编辑以下行:
db_shell:/usr/bin/fish

这种方法的不利/有利方面是,如果您有多个用户,则此更改会影响所有用户。好的一面是它非常简单。唯一的问题是您必须重新启动 Cygwin。
如果您确实使用 mkpasswd进行此更改后,它将为所有允许登录的用户使用新的默认 shell。

引用
1 mkpasswd文档是这样说的:

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.


我真的在 user's guide 中找不到任何可靠的推理,除了提到您必须重新生成 /etc/passwd/etc/group如果您的用户和组发生变化,我认为这是一个足够好的理由。我可以说这个过程对于新手来说有点容易出错。

关于shell - 在 Cygwin 中设置默认 Shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22363210/

相关文章:

java - Shell 排序算法比归并排序算法有何优势?

linux - Bash:杀死子进程中的所有进程

javascript - 如何加入npm命令?

logging - Cygwin 上的 syslog 输出存储在哪里?

fish - 有条件地在 fish 中设置局部变量

function - fish shell : Check if argument is provided for function

linux - 为什么 "pgrep -f bash"发出两个数字而不是一个?

multithreading - timed_mutex 不会在 Cygwin 4.8.2 ('timed_mutex' 下编译,命名空间 'std' 没有命名类型)

latex - Cygwin w/TeXnicCenter 或 WinEdt - 它们可以缝制/集成以一起工作

shell - 使用不同的配置文件夹启动 fish shell