Subject: Re: Bash + Shell hack = ?
From: Jonathan M Merz <[email-masked]>
To: Luke Bakken <[email-masked]>
Cc: [email-masked]
Date: Fri, 22 Sep 2000 11:10:04 -0500

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 [email-masked]
> 
--
Want to unsubscribe from this list?
Send a message to [email-masked]