* Re: Bash + Shell hack = ? [not found] <39CB8334.35C6BFF5@genomecorp.com> @ 2000-09-22 9:41 ` Luke Bakken 0 siblings, 0 replies; 4+ messages in thread From: Luke Bakken @ 2000-09-22 9:41 UTC (permalink / raw) To: Jonathan Segal; +Cc: cygwin This is what I had to do with this: c:\cygwin\bin\bash.exe -c "cd '%1';exec /usr/bin/bash --rcfile /home/administrator/.bash_shell_profile" I had to create that separate rcfile since the /etc/profile file has a cd $HOME in it - i removed that from this one to keep it from cd'ing to /home/administrator every time, and I can still start up bash the normal way (ie the Cygwin icon) and be taken to my home dir. Thanks for the suggestion - it steered me in the right way!! Luke On Fri, 22 Sep 2000, Jonathan Segal wrote: > Neat idea! > > To do this with bash, try something like > > d:\cygwin\bin\bash.exe -c "cd %1; exec /usr/bin/bash -i" > > replace d:\cygwin\bin with wherever bash is on your system. > > Enjoy, > -Jonathan > > Luke Bakken wrote: > > > Hi, > > > > I've got an option for my "File Folder" file type so that if I right-click > > on a folder, I can execute a cmd.exe prompt in that folder: > > > > cmd.exe /K cd "%1" > > > > What I'm wondering is if something analogous to the /K switch exists for > > Bash, so that I can run a command before starting the login shell. the > > "-c" option is similar, but the shell exits after running the command > > specified. What I want is for it not to exit. > > > > Thanks, > > Luke > > > > -- > > Want to unsubscribe from this list? > > Send a message to cygwin-unsubscribe@sourceware.cygnus.com > > -- > Jonathan Segal > Principal Software Engineer/Group Leader, Bioinformatics > Genome Therapeutics Corp. > jonathan.segal@genomecorp.com > (781) 398-2579 > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gmake is slow under cygwin
@ 2000-09-22 7:55 Earnie Boyd
2000-09-22 8:49 ` Bash + Shell hack = ? Luke Bakken
0 siblings, 1 reply; 4+ messages in thread
From: Earnie Boyd @ 2000-09-22 7:55 UTC (permalink / raw)
To: Gabriel Zachmann, cygwin
--- Gabriel Zachmann <zach@igd.fhg.de> wrote:
>
> Any ideas or insights will be highly appreciated,
> Gab.
>
Any virus scanners running? See the FAQ.
Cheers,
=====
--- < http://earniesystems.safeshopper.com > ---
Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
__Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
__Minimalist GNU for Windows__
Mingw Home: < http://www.mingw.org/ >
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Bash + Shell hack = ? 2000-09-22 7:55 gmake is slow under cygwin Earnie Boyd @ 2000-09-22 8:49 ` Luke Bakken 2000-09-22 9:13 ` Jonathan M Merz 2000-09-22 22:55 ` Chris Abbey 0 siblings, 2 replies; 4+ messages in thread From: Luke Bakken @ 2000-09-22 8:49 UTC (permalink / raw) To: egcs; +Cc: cygwin Hi, I've got an option for my "File Folder" file type so that if I right-click on a folder, I can execute a cmd.exe prompt in that folder: cmd.exe /K cd "%1" What I'm wondering is if something analogous to the /K switch exists for Bash, so that I can run a command before starting the login shell. the "-c" option is similar, but the shell exits after running the command specified. What I want is for it not to exit. Thanks, Luke -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bash + Shell hack = ? 2000-09-22 8:49 ` Bash + Shell hack = ? Luke Bakken @ 2000-09-22 9:13 ` Jonathan M Merz 2000-09-22 22:55 ` Chris Abbey 1 sibling, 0 replies; 4+ messages in thread From: Jonathan M Merz @ 2000-09-22 9:13 UTC (permalink / raw) To: Luke Bakken; +Cc: cygwin [-- Attachment #1: Type: text/plain, Size: 2392 bytes --] Hi, I actually was trying to do the same thing a few weeks ago and came up with an ugly hack, but it gets the job done. The problem is that any time you run a bash --login, it drops you into your home directory, so you actually need to run the cd command _after_ starting the login shell. The way I managed this is to have a windows batch file call a bash shell script (since I'd rather write shell scripts than batch files) that creates a file containing the cd command to whatever the directory is. The two files for that are gotodir.bat and gotodir.sh (I've attached them). Then, I put a check in the bottom of my .bashrc and .profile to see if the file with the cd command exists, and if it does, execute it, then delete it (so that it won't be run if I just want to start a login shell in my home directory. So, to set it up (I warned you, this is ugly): 1. put gotodir.sh in your $HOME/bin directory (This can be changed, but you'll have to edit gotodir.bat to do it) 2. put gotodir.bat anywhere you like, just so you know where it is. 3. add the following to your .bashrc or .profile: test -f ~/.chdirrc && . ~/.chdirrc test -f ~/.chdirrc && rm ~/.chdirrc 4. in the windows registry, add: [HKLM]\SOFTWARE\Classes\Folder\shell\Bash Prompt Here (Make this whatever you want to see in the context menu) [HKLM]\SOFTWARE\Classes\Folder\shell\Bash Prompt Here\command in the command key, add the string "c:\winnt\system32\cmd.exe /c <path to gotodir.bat>\gotodir.bat" Hopefully I have the setup correct there. If not, let me know what's not working and hopefully I'll be able to correct myself. And if anyone knows of or can come up with a cleaner way to do this, please let us all know. Hope it helps, Jon On Fri, Sep 22, 2000 at 08:48:04AM -0700, Luke Bakken wrote: > Hi, > > I've got an option for my "File Folder" file type so that if I right-click > on a folder, I can execute a cmd.exe prompt in that folder: > > cmd.exe /K cd "%1" > > > What I'm wondering is if something analogous to the /K switch exists for > Bash, so that I can run a command before starting the login shell. the > "-c" option is similar, but the shell exits after running the command > specified. What I want is for it not to exit. > > Thanks, > Luke > > > -- > Want to unsubscribe from this list? > Send a message to cygwin-unsubscribe@sourceware.cygnus.com > [-- Attachment #2: gotodir.bat --] [-- Type: text/plain, Size: 59 bytes --] REM ECHO OFF bash %HOME%\bin\gotodir.sh bash --login -i [-- Attachment #3: gotodir.sh --] [-- Type: text/plain, Size: 99 bytes --] echo cd $PWD > $HOME/.chdirrc echo rm .chdirrc >> $HOME/.chdirrc echo clear >> $HOME/.chdirrc ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bash + Shell hack = ? 2000-09-22 8:49 ` Bash + Shell hack = ? Luke Bakken 2000-09-22 9:13 ` Jonathan M Merz @ 2000-09-22 22:55 ` Chris Abbey 1 sibling, 0 replies; 4+ messages in thread From: Chris Abbey @ 2000-09-22 22:55 UTC (permalink / raw) To: luke_bakken; +Cc: cygwin If y'all don't mind I'd like to suggest a slightly cleaner way of doing this. Starting from the windows explorer end. Windows automatically passes the fully qualified path to the object as arg 1, so just create an item that points to cygwin.bat however you wish, mine is called "bash this" and the command to run is simply "d:\cygwin\cygwin.bat". Windows will automatically call it with the full path, so if you choose this on c:\yada it would run "d:\cygwin\cygwin.bat c:\yada". Now to that we've got it into cygwin.bat we need to propagate it further, using an environment variable is easiest... here's my cygwin.bat: @set STARTIN=%1 @d:\cygwin\bin\bash --login -i the only line there that is important to this is the one setting the STARTIN envvar, as this is how we pass it on to bash... in order to act on it I've replaced this line in /etc/profile: cd $HOME with this logic: if [ ! -z "$STARTIN" ]; then if [ -d "$STARTIN" ]; then cd "$STARTIN" else echo "$STARTIN is not a valid path." cd $HOME fi unset STARTIN else cd $HOME fi which also requires these lines to be changed, as . and ~ may no longer be the same directory at this point in the script: test -f ./.profile && . ./.profile test -f ./.bashrc && . ./.bashrc becomes: test -f ~/.profile && . ~/.profile test -f ~/.bashrc && . ~/.bashrc This gives you a couple other advantages: such as you can create an icon to open a bash prompt to any given location (I like one in my start bar that automatically puts me in the root of my products build tree.) and you can open a new bash window from any dos prompt with 'start cygwin .' Note that if you want to be able to handle spaces in paths then you can replace STARTIN's assignment with this: set STARTIN=%1 %2 %3 %4 %5 %6 %7 %8 %9 which will allow you to have up to 8 spaces in the total path; the downside to this is that the initial prompt will look a bit odd (trailing spaces) until you cd the first time. p.s. any relation to Kirby? -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-09-22 22:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <39CB8334.35C6BFF5@genomecorp.com> 2000-09-22 9:41 ` Bash + Shell hack = ? Luke Bakken 2000-09-22 7:55 gmake is slow under cygwin Earnie Boyd 2000-09-22 8:49 ` Bash + Shell hack = ? Luke Bakken 2000-09-22 9:13 ` Jonathan M Merz 2000-09-22 22:55 ` Chris Abbey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).