Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cygwin + console2: running cygwin bash with startup dir

I am using Console2 as a bash wrapper on Windows. Most importantly, it enables me to start up a new bash tab in a predefined project directory.

Now I would like to replace the Windows command line by a Cygwin bash. However, the "Startup Dir" setting in Console2 is not respected by Cygwin.

Basically, I see three solution approaches:

  • Figure out how the Console2 setting has to look like so that the Cygwin bash respects it
  • Add a startup parameter to the Cygwin bash, setting the startup directory
  • Automatically run a script after bash startup that changes the directory

Searching around in Cygwin's documentation and the rest of the Internet, I could not find a solution to any of those approaches. I could imagine that the solution is trivial to someone else, though. :)

environment: Win XP, Console 2.00.146, Cygwin 1.7.7, GNU Bash 3.2.51(24)

like image 420
crispy Avatar asked Sep 28 '10 13:09

crispy


2 Answers

As for the last bullet point, edit your ~/.bashrc and add a cd command at the end.

Instead of that, you can try this for your first bullet point: If your Console2 configuration to start Bash looks something like this:

bash --login -i

change it to:

bash --login -i -c 'cd somdir; exec bash'
like image 88
Dennis Williamson Avatar answered Sep 30 '22 13:09

Dennis Williamson


I was having the same problem, saw your post, and then found this answer:

  1. Run the Setup.exe Cygwin installer and add the "chere" package
  2. In Console2, add a new tab called "Bash" with a shell path of "C:\cygwin\bin\bash". See screenshot.
  3. Finally, add the following to the registry: Code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Open Cygwin Here...]

[HKEY_CLASSES_ROOT\Directory\shell\Open Cygwin Here...\command] @="\"C:\Program Files\Console2\Console.exe\" -t Bash -r \"/bin/xhere /bin/bash.exe '%L'\""

Found this solution at: http://www.e-texteditor.com/forum/viewtopic.php?p=8884

like image 42
zen Avatar answered Sep 30 '22 14:09

zen