Peter's Blog

Redefining the Impossible

Items filed under bashmicrosoft


I'm using cygwin bash as my default shell these days as my work is all on cygwin. To complete the cygwininess of the setup it is necessary to lose cmd.exe and finally free oneself of the limitations of Microsoft's 32 bit dos prompt.

To ~/.bashrc I add:

declare PATH=/bin:$PATH

because my cygwin /bin utilities get top priority.

For a shell I use rxvt. I set it up based on this page, the meaty bits of which I duplicate for my own personal reference, slightly tweeked to my preferences:

Step 1: Edit ~/.Xdefaults - the settings below create an 132x50 terminal window with a deep-blue-black background and yellow-white text (looks nice, easy on the eyes) and assign VIM-style color codes:

   1  ! ~/.Xdefaults - X default resource settings
   2  Rxvt*geometry: 130x50
   3  Rxvt*background: #000000
   4  Rxvt*foreground: #e0e0e0
   5  !Rxvt*borderColor: Blue
   6  !Rxvt*scrollColor: Blue
   7  !Rxvt*troughColor: Gray
   8  Rxvt*scrollBar: True
   9  Rxvt*scrollBar_right: True
  10  Rxvt*font: Lucida Console-16
  11  Rxvt*SaveLines: 2000
  12  Rxvt*loginShell: True
  13  ! VIM-like colors
  14  Rxvt*color0:    #000000
  15  Rxvt*color1:    #FFFFFF
  16  Rxvt*color2:    #00A800
  17  Rxvt*color3:    #FFFF00
  18  Rxvt*color4:    #0000A8
  19  Rxvt*color5:    #A800A8
  20  Rxvt*color6:    #00A8A8
  21  Rxvt*color7:    #D8D8D8
  22  Rxvt*color8:    #000000
  23  Rxvt*color9:    #FFFFFF
  24  Rxvt*color10:   #00A800
  25  Rxvt*color11:   #FFFF00
  26  Rxvt*color12:   #0000A8
  27  Rxvt*color13:   #A800A8
  28  Rxvt*color14:   #00A8A8
  29  Rxvt*color15:   #D8D8D8
  30  ! eof

Step 2: Modify your c:\cygwin\cygwin.bat to invoke your shiny new Rxvt instead of cmd.exe:

@echo off
C:
chdir C:\cygwin\bin
set EDITOR=vi
set VISUAL=vi
set CYGWIN=codepage:oem tty binmode title
rxvt -e bash --login -i

Now make a shortcut to /cygwin/cygwin.bat and life is sweet.

Oh! That's nice, it remembers my command history from the last time I ran it. Almost as if whoever wrote it had to use it.


Filed under: bash bashmicrosoft cygwin

Add a comment