I am running Cygwin as an Inferior Shell in Emacs. Here's the basic step I am following:

  • C-u M-x shell (rename the buffer to cygwin)
  • cd \cygwin
  • cygwin.bat

Here's what I see:

[32muser1@mymachine [33m~[0m

If I run cygwin.bat outside of emacs, it gives me:

user1@mymachine ~

I could almost deal with the extra characters, but when I try ls here's the result:

$ ls
bash: $'ls\r': command not found

I must be doing something wrong. Any suggestions?

EDIT: M-x ansi-color-for-comint-mode-on fixed the prompt, but the system is still not able to decode the ls command.


Here's the fix for the unix linefeed junk: http://osdir.com/ml/emacs.windows/2007-12/msg00007.html

Basically, just run:

M-x set-buffer-process-coding-system

with 'undecided-unix and 'undecided-unix parameters.

Also, change the prompt to be:

export PS1="\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$"

The default PS1 causes ugly errors.

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.