delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/01/05:27:05

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
Message-ID: <3500515B75D9D311948800508BA37955950550@EX-LONDON>
From: Vince Hoffman <Vince DOT Hoffman AT uk DOT circle DOT com>
To: cygwin AT cygwin DOT com
Subject: RE: Executing bash commands from the bash command line
Date: Thu, 1 Aug 2002 10:26:07 +0100
MIME-Version: 1.0

found a solution here.
http://www.cygwin.com/ml/cygwin/2002-05/msg01680.html
thanks for the reminder Hamish, been meaning to add "bash shell here" to my
context menu for a while but never got round to finding a way to.

-----Original Message-----
From: Michael Beach [mailto:michaelb AT ieee DOT org]
Sent: 01 August 2002 09:24
To: Hamish Fawns; cygwin AT cygwin DOT com
Subject: Re: Executing bash commands from the bash command line


On Thursday 01 August 2002 17:15, Hamish Fawns wrote:
> > bash -c "cd /cygdrive/c/myfolder ; exec bash"
>
> Dear George,
>     I did as you suggested however when I called "exec bash" after
changing
> the directory a new instance of bash was spawned but when a new instance
of
> bash was spawned it started in my home directory (~).
>

Hmm, who the hell is George?

All I can suggest here is that perhaps your bash thinks it is a login shell,

and so is processing commands from /etc/profile. I believe the standard 
/etc/profile includes a line which cd's to the user's home directory.

Presumably you want a bash started in such a way to actually be a login 
shell. What I would suggest is supplying an alternate start up file to bash 
which just sources the standard ones and then cd's to the directory you want

afterwards. The name of the directory can be passed to the cd via an 
environment variable which is set before you invoke the shell in the first 
place. The alternative is to just substitue your own startup script which 
does what /etc/profile does but doesn't fool with the current directory, but

this then means that you've effectively cut and pasted large chunks of 
/etc/profile to create your own startup script, with all the associated 
problems of tracking changes etc.

I would also suggest reading the bash man page. This, along with reading 
/etc/profile and any other bash startup files in your home dir, will answer 
ALL questions of the form "Why does bash do XYZ when I start it with command

line PQR".

>     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/

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