10

There is already one answered the question at Best way to use a shell with Cygwin in Windows 7. That is to start Cygwin with C:\cygwin\bin\mintty.exe -

With that $SHELL = /bin/sh

How can I launch mintty with /usr/bin/bash as default shell?

14

There are several different ways to do it:

  1. Specify bash as a command-line argument to mintty, as mentioned by Salton.
  2. Set the Windows SHELL environment variable to /usr/bin/bash.
  3. Make sure you have an /etc/passwd (see mkpasswd(1)) in your Cygwin environment, and set the shell for your UID to /usr/bin/bash. Cygwin doesn't supply a chsh or usermod command, so you'll probably have to edit the file by hand if you want to use this method.

From the mintty(1) manpage:

INVOCATION
   If a program name is supplied on the command line, this is executed
   with any additional arguments given.  Otherwise, mintty looks for a
   shell to execute in the SHELL environment variable.  If that is not
   set, it reads the user's default shell setting from /etc/passwd.  As a
   last resort, it falls back to /bin/sh.  If a single dash is specified
   instead of a program name, the shell is invoked as a login shell.
  • For me the 3rd approach, setting up the shell in /etc/passwd is the best, so that mintty can be run as /path/to/mintty.exe [-i icon-file] -, with the trailing - we get a login shell which I usually start a screen session. – ryenus Apr 21 '14 at 1:28
  • /etc/passwd gets overwritten (sometimes?) when upgrading with Cygwin setup. – Dominykas Mostauskis Mar 12 '15 at 13:24
  • @ryenus what's the reason for that trailing -? Talk about difficult to google.. – Roy Truelove Aug 19 '16 at 1:21
  • @RoyTruelove to make it a login shell? Probably, please check bash manual – ryenus Aug 19 '16 at 9:50
5

You can launch mintty bash for bash to be default

4

suppose this file name is mintty.bat, double click this file will open a mintty terminal, and with bash, path & pwd all settled down.


@echo off

C:\cygwin64\bin\mintty.exe /bin/bash --login -i

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.