Reputation: 5877
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:
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)
Upvotes: 18
Views: 12914
Reputation: 269
Change the shell dir to:
bash --login -i -c 'cd /cygdrive/c/...; exec /bin/bash'
Add this line to the end of C:\cygwin\home\USERNAME\.profile
cd -
Upvotes: 0
Reputation: 742
I had some problems with some with the approaches above (Console2 window screwed up when using c:\cygwin\bin\bash.exe as shell, xhere not reflecting my actual working dir).
So I created this batch file and used it as Console2's shell:
C:\cygwin64\cygbash.bat:
C:\cygwin64\bin\bash --login -i -c "/bin/xhere /bin/bash `cygpath -d '%CD%'`"
Upvotes: 3
Reputation: 31
I tried variations of all the above, but none worked. This is what worked for me using Console2 v2.00.148:
1)..Copy the Cygwin.bat to a new file: Cygbash.bat.
2)..Replace the last line to be this: bash --login -i -c 'cd /cygdrive/c/; exec bash'
3)..Go into Console2 settings and change the shell to point to this new Cygbash.bat file.
The above will start Console2 in the root of your C drive. fyi - I'm the original poster, just forgot to login to my account first.
Upvotes: 3
Reputation: 121
C:\cygwin\bin\bash.exe -c '/bin/xhere /bin/bash'
Upvotes: 5
Reputation: 570
I was having the same problem, saw your post, and then found this answer:
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
Upvotes: 6
Reputation: 496
Regarding your last bullet point, you can put for example:
cd /cygdrive/d
in ~/.bash_profile This will be picked up when using Console2 and also when you run Cygwin itself.
Upvotes: 0
Reputation: 360075
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'
Upvotes: 23