How can I run Cygwin Bash Shell from within Emacs?

后端 未结 8 1653
温柔的废话
温柔的废话 2020-12-01 01:34

I am running GNU Emacs on Windows so entering:

M-x shell

launches the Windows command-line DOS shell. However, I would like to instead be a

8条回答
  •  自闭症患者
    2020-12-01 02:04

    You can run bash directly from the default Windows command-line shell within your Emacs *shell* buffer:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\temp>bash
    bash     
    

    However, no command prompt is visible which can be disorienting resulting in your commands and their output results all blending together.

    In addition, for some unknown reason, if you do enter a command and hit return, a return line character (\r) is appended to the end of your command statement causing a bash error:

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

    A workaround is to manually add a comment character (#) at the end of every command which effectively comments out the \r text:

    ls #
    myfile,txt
    foo.bar
    anotherfile.txt
    

    This overall approach is far from ideal but might be useful if you want to drop into bash from Windows' native shell to do some quick operations and then exit out to continue working in Windows.

提交回复
热议问题