delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/01/02:43:41

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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>
Subject: Re: Executing bash commands from the bash command line
Date: Thu, 1 Aug 2002 16:50:16 +1000
References: <004101c23925$9d5f5900$9701320a AT flareon>
In-Reply-To: <004101c23925$9d5f5900$9701320a@flareon>
MIME-Version: 1.0
Message-Id: <0208011650160J.13014@gilgamesh>

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019