Page 1 of 1
Opening Cygwin Bash console from XYp?
Posted: 01 Oct 2010 19:49
by kartal
Hi
I am trying to open Cygwin Bash console from XYp and I cannot get to anywhere
Here is the command to run it normally inside Windows
Code: Select all
C:\cygwin\bin\bash -c "/bin/xhere /bin/bash.exe '%L'"
So I change it to
Code: Select all
C:\cygwin\bin\bash -c "/bin/xhere /bin/bash.exe <curpath>"
and add to "open" commands, but it does not work nothing , no screen or shell opens for me

Maybe someone can help me out here
thanks
Re: Opening Cygwin Bash console from XYp?
Posted: 04 Oct 2010 02:58
by nas8e9
kartal wrote:I am trying to open Cygwin Bash console from XYp and I cannot get to anywhere
Here is the command to run it normally inside Windows
Code: Select all
C:\cygwin\bin\bash -c "/bin/xhere /bin/bash.exe '%L'"
This doesn't work for me at all (no screen, no error message) with a vanilla installation of the current Cygwin on Windows 7 x64.
So I change it to
Code: Select all
C:\cygwin\bin\bash -c "/bin/xhere /bin/bash.exe <curpath>"
and add to "open" commands, but it does not work nothing , no screen or shell opens for me

I'd try it with the XYplorer variable outside the quotes like so:
Code: Select all
C:\cygwin\bin\bash -c "/bin/xhere /bin/bash.exe" <curpath>
I'm guessing that XYplorer treats everything within double quotes literally and thus doesn't recognise its own variable.
Finally, according to XYplorer's help on the "open" scripting command:
Note that the application must be double-quoted when command line parameters are used! If the whole argument is single-quoted, the contained double-quotes don't have to be doubled.
so:
Code: Select all
'"C:\cygwin\bin\bash" -c "/bin/xhere /bin/bash.exe" <curpath>'
I'm not sure how the double quotes in the bash parameter should be encoded given the single quotes around the whole parameter for the "open" function.
Unfortunately, even with the two changes above I couldn't get it to work. I know a little Linux but bash not so much, which doesn't help.
I hope *some* of the above is of use (or indeed at all relevant

).
Cygwin current dir in XY: I have it working!
Posted: 19 Feb 2013 14:49
by Malkyne
I know that this is an ancient thread, but I think I've got it working, and I wanted to post it up here, in case it helps someone else!
What you were missing in the above attempts is that you need a terminal window to open that bash up in. Cygwin uses mintty by default. So, I did some research, trying to figure out what the right string was to get what we wanted. The tricky part turned out to be that bash needed a path in a Cygwin-friendly unix format, so I had to do a bit of conversion on <curpath> to feed it in there.
But, it works! When I click on my Cygwin button, it opens a Cygwin mintty terminal window with a bash prompt, in the currently selected directory. I believe that "chere" provides "xhere" in the Cygwin packages, so make sure that's installed, for this to work.
This is my button code:
Code: Select all
$path = "/cygdrive/" . recase(substr("<curpath>", 0, 1), "lower") . replace(substr("<curpath>", 2), "\", "/"); open """D:\cygwin\bin\mintty.exe"" -e /bin/xhere /bin/bash.exe $path"
IMPORTANT NOTE: Don't forget to change that "D:\cygwin" part to the correct cygwin root on your own machine.
Happy XYploring!
Re: Opening Cygwin Bash console from XYp?
Posted: 19 Feb 2013 15:03
by admin
Wow, cool, thanks for that!
And welcome,
Don
Re: Opening Cygwin Bash console from XYp?
Posted: 03 Nov 2014 11:40
by lorddevi
Excellent!
I am loving Xyplorer so far I must say.
The above trick worked fine for me as well. However, it does not seem to open Cygwin in the current directory if my current path has any directories in it that include spaces.
Is there a way to tweak the above so that the $path variable expands to have double quotes around the path or something perhaps?
Re: Opening Cygwin Bash console from XYp?
Posted: 03 Nov 2014 11:48
by PeterH
lorddevi wrote:Excellent!
I am loving Xyplorer so far I must say.
The above trick worked fine for me as well. However, it does not seem to open Cygwin in the current directory if my current path has any directories in it that include spaces.
Is there a way to tweak the above so that the $path variable expands to have double quotes around the path or something perhaps?
If I see it right, just try:
Code: Select all
$path = "/cygdrive/" . recase(substr("<curpath>", 0, 1), "lower") . replace(substr("<curpath>", 2), "\", "/"); open """D:\cygwin\bin\mintty.exe"" -e /bin/xhere /bin/bash.exe ""$path"""