This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Executing bash commands from the bash command line
- From: Michael Beach <michaelb at ieee dot org>
- To: "Hamish Fawns" <fawnha at aie dot act dot edu dot au>, <cygwin at cygwin dot com>
- Date: Thu, 1 Aug 2002 16:50:16 +1000
- Subject: Re: Executing bash commands from the bash command line
- References: <004101c23925$9d5f5900$9701320a@flareon>
On Thursday 01 August 2002 16:35, Hamish Fawns wrote:
> Dear All,
> I am trying to create a "Bash Here" utility that will allow me to open
> a Bash window in any directory by right clicking in the window and
> selecting "Bash Here" (similar to the "Command Prompt Here" Microsoft
> Powertoys utility). To do this I need to be able to cd to a given directory
> from the bash command line, for example:
>
> bash "cd /cygdrive/c/myfolder" where "myfolder is a variable.
>
> How can I do this?
I think the trick here is to change to the directory BEFORE you run bash, eg
instead of
bash "cd /cygdrive/c/myfolder"
do something like
cd /cygdrive/c/myfolder ; bash
Or if you're not actually doing this in the context of a bash command line to
begin with, then perhaps something like
bash -c "cd /cygdrive/c/myfolder ; exec bash"
or if you're actually launching it from Win32 code (eg if you're writing some
kind of wacky DLL to plug into Explorer) then why not just supply the desired
directory as a the lpCurrentDirectory argument to CreateProcess()? I think
this is by far the simplest and most robust way of dealing with this issue.
>
> Thanks,
> Hamish
>
Regards
M.Beach
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/