Search code examples
windowsbashcommand-lineconsolecygwin

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)


Solution

  • 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'