This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

RE: Executing bash commands from the bash command line


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@ieee.org]
Sent: 01 August 2002 09:24
To: Hamish Fawns; cygwin@cygwin.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/


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