将cygwin bash转换为tcsh

时间:2012-05-17 08:32:29

标签: cygwin

我怎样才能将我的cygwin bash转换为c Shell 我试过更改安装目录中的.bat文件,如:
@echo off
@echo ----Welcome NAME----
@echo 'have a nice day'
cygdrive\
chdir \
set HOME=\cygwin\home\
tcsh -i

请帮忙。
这是正确的过程吗?
虽然它对我有用... ... 有任何想法吗...?

2 个答案:

答案 0 :(得分:4)

要更改Cygwin shell,您可以更改/etc/passwd文件。每行都是用户帐户的分隔列表,其中最后一个条目是该用户的shell。只需更改读取的行,例如:

abhisek:[some other stuff]:/usr/bin/bash

为:

abhisek:[some other stuff]:/usr/bin/tcsh

答案 1 :(得分:2)

Cygwin的当前版本没有 / etc / passwd 文件,而我正在处理的系统在我的控制范围内的域数据库中有Windows帐户信息。因此,不再支持 chsh

我还发现 bash 没有硬编码到 startxwin 脚本中,也没有在任何 .bat 文件中进行硬编码。事实证明,你根本不需要使用 .bat 文件。

搜索如何更改我的shell,我找到了一些关于 mkpasswd

的建议

我把它添加到混合物中。

该页面说:

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 / tcshX'| tee -a / etc / passwd

瞧,瞧!下次我打开Cygwin终端时,它直接进入了tcsh

这就是方式(嗯,嗯!)我喜欢它。

相关问题