delorie.com/archives/browse.cgi | search |
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 18:24:19 +1000 |
References: | <004101c23925$9d5f5900$9701320a AT flareon> <0208011650160J DOT 13014 AT gilgamesh> <006501c2392b$29e5faf0$9701320a AT flareon> |
In-Reply-To: | <006501c2392b$29e5faf0$9701320a@flareon> |
MIME-Version: | 1.0 |
Message-Id: | <0208011824190L.13014@gilgamesh> |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |