Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Basically my question is closely related to this one:

http://stackoverflow.com/questions/21905380/how-do-i-get-cygwin-xterm-to-use-bash-and-not-sh

I also want to set bash as the default shell for xterm (I'm working on Cygwin). Some time ago bash was default for xterm, recently it has changed for some reason.

Now, I do have the file /etc/shells with the content given in the link above. That did not help.

The easiest way to reproduce the behavior I'm unhappy with is just to type "xterm" in a shell (say, bash). The new terminal starts with sh and not bash.

I know that one can do 'xterm -e bash', but it is not quite satisfactory because this flag has to be given every time.

Hope somebody can help.

share|improve this question
    
As I understand this is the wrong place to post this question. If somebody reads these lines, could you suggest where I could find people to answer this question? –  user3556729 Apr 23 at 9:24

1 Answer 1

up vote 1 down vote accepted

I found out that after the question was posted here, a new answer was posted at

http://stackoverflow.com/questions/21905380/how-do-i-get-cygwin-xterm-to-use-bash-and-not-sh

which is the link given in the question itself. This last answer there helped me to resolve the problem. So that's the whole list of things which may be important:

For genuine linux systems one can use "chsh -s " to set your default shell. However the command "chsh" just seems to be absent in Cygwin.

To make sure that bash is the default shell for xterm under Cygwin you need (at least) to do the following:

1) make sure bash is installed (just check by "which bash")

2) make sure bash is listed in /etc/shells (this file should be created if absent, cf. link above to find an example for /etc/shells)

3) make sure in /etc/passwd the default shell for the user in question is set correctly including the path, e.g. /bin/bash

However, all that didn't help me. It's only the last bit which really made xterm start with bash by default:

4) the file /bin/bash (change to valid path if needed) should be set to chmod 755 instead of 700. That means all users should be able to execute it. Note that chmod-permission in Cygwin are not necessarily derived from the Windows permissions you set in the cygwin folder under windows.

So I just typed "chmod 755 /bin/bash" and it did what it should!

It seems that during one of the recent updates of Cygwin the chmod-permissions for /bin/bash have changed leading to the strange behavior described above.

Hope very much to help somebody with all that, so my pain was not in vain.

P.S. to check which shell you are currently running use either "echo $SHELL" or "ps -p $$" If the results differ the second one should be trusted. E.g. when you start a new shell in the terminal $SHELL may not change, but the output of "ps -p $$" would change

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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