This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Bash Prompt Here


I'm sorry, but I'll have do disagree... ;) I have just tried Andy's
suggestion, and it indeed works -- *but* you have to remove the --login to
prevent the shell from changing to your $HOME at startup. In my case, this
meant I had to "improve" my ~/.bashrc file (importing some settings that
were only on the ~/.profile). After that, the "BashHere" works ok.

... on a second thought, I'm not sure the behavior is 100% ok. The thing is:
if you right-click a directory on an Explorer window and launch the
"BashHere" command, bash will start on the directory displayed on the
titlebar, and not on the highlighted dir. For me, this behavior is good
enough, but I understand that others might not think that way.

Best,

Andre Costa
--
André Oliveira da Costa
(andre.costa@starmedia.net)


> -----Original Message-----
> From: cygwin-owner@sources.redhat.com
> [mailto:cygwin-owner@sources.redhat.com]On Behalf Of Luke Bakken
> Sent: Tuesday, October 03, 2000 10:10 AM
> To: Andy Philpotts
> Cc: Evan McLean; cygwin@sources.redhat.com
> Subject: Re: Bash Prompt Here
>
>
> Actually, this does not work, as you are not passing the directory
> argument to bash in any way.
>
> You can try this, however, given to me by someone else recently on this
> mailing list:
>
> [HKEY_CLASSES_ROOT\Directory\shell\BashHere\command]
>    c:\cygwin\sygwin2.bat %1
>
> where cygwin2.bat =
>
> @set STARTIN=%1 %2 %3 %4 %5 %6 %7 %8 %9
> @c:\cygwin\bin\bash.exe --login -i
>
> Then, in your /etc/profile, change the cd $HOME line to this:
>
> if [ ! -z "$STARTIN" ]; then
>    if [ -d "$STARTIN" ]; then
>      cd "$STARTIN"
>    else
>      echo "$STARTIN is not a valid path."
>      cd $HOME
>    fi
>    unset STARTIN
> else
>    cd $HOME
> fi
>
> Mind that there is a limit with this solution to the number of spaces in
> the directory argument.  The method of redirecting %1 to a file also works
> well, and actually was my first solution, but i like the above better.
> The real problem is that, unlike cmd.exe, bash does not support an
> "initial command" argument like the /K switch on cmd.exe.  There is a -c
> argument to bash, but bash exits after executing that command.
>
>
>
> On Tue, 3 Oct 2000, Andy Philpotts wrote:
>
> > Hello Evan,
> >
> > This seems a little simpler to me:
> >
> > [HKEY_CLASSES_ROOT\Directory\shell\BashHere\command]
> >    d:\cygwin\bin\bash.exe --login -i
> >
> > No extra files or indirection needed
> >
> > Monday, October 02, 2000, 6:20:09 PM, you wrote:
> >
> > EM> Hi,
> >
> > EM> I've come up with a way to right-click on a directory in
> Windows Explorer
> > EM> and have a menu option called "Bash Prompt Here" that will
> open a bash
> > EM> prompt with the selected directory as the current one.
> It's a bit kludgy,
> > EM> but I thought I'd submit it for any who may find it useful.
>  Works under
> > EM> Win98 and WinME.  Be interested to know how it goes on NT variants.
> >
> > EM> This is using cygwin 1.x and assumes that your cygwin
> installation is in
> > EM> "c:\cygwin" which is mounted as your root directory.
> Change to suite your
> > EM> own environment.
> >
> > EM> Create a file "c:\cygwin\start_at.bat" with the following
> three lines:
> >
> > EM>         @echo off
> > EM>         echo cd %1 > c:\cygwin\start_dir.txt
> > EM>         c:\cygwin\cygwin.bat
> >
> > EM> Add the following four lines to the end of "/etc/profile" (or
> > EM> "c:\cygwin\etc\profile"):
> >
> > EM>         if [ -f /start_dir.txt ] ; then
> > EM>           . /start_dir.txt
> > EM>           rm /start_dir.txt
> > EM>         fi
> >
> > EM> Lastly, apply the following registry patch file (which I name
> > EM> "bash_prompt_here.reg"):
> > EM> ----------snip----------
> > EM> REGEDIT4
> >
> > EM> [HKEY_CLASSES_ROOT\Directory\shell\BashHere]
> > EM> @="&Bash Prompt Here"
> >
> > EM> [HKEY_CLASSES_ROOT\Directory\shell\BashHere\command]
> > EM> @="C:\\WINDOWS\\COMMAND.COM /E:4096 /c
> C:\\cygwin\\start_at.bat \"%L\""
> >
> > EM> ----------snip----------
> >
> > EM> That's it.  If anybody can offer any improvements, let me know.
> >
> > EM> E.
> >
> >
> > EM> --
> > EM> Want to unsubscribe from this list?
> > EM> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
> >
> >
> >
> > --
> > Andy Philpotts
> > Senior Software Developer
> > CalendarCentral Inc.
> > [w] 919/654-6200  xt.155
> > [c] 919/656-1166
> > [e] andy.philpotts@calendarcentral.com
> > [www] www.calendarcentral.com
> >
> > Andy says: I don't suffer from insanity, I enjoy every minute of it.
> >
> >
> >
> > --
> > Want to unsubscribe from this list?
> > Send a message to cygwin-unsubscribe@sourceware.cygnus.com
> >
>
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
>


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]