delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/28/10:20:15

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
MIME-Version: 1.0
Sensitivity:
To: "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
Cc: cygwin AT cygwin DOT com
Subject: Re: Bash Here - Start Cygwin from a folders context menu
From: "Thomas Schweikle" <tschweikle AT fiducia DOT de>
Message-ID: <OFFCA6F123.4A5ED0F3-ONC1256BC7.004BDC82-C1256BC7.004EA3D9@fag.fiducia.de>
Date: Tue, 28 May 2002 17:18:54 +0200

Hi!



Bitte antworten an "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
Gesendet von:   cygwin-owner AT cygwin DOT com
An:     David Starks-Browning <starksb AT ebi DOT ac DOT uk>
Kopie:  cygwin AT cygwin DOT com 
Thema:  Re: Bash Here - Start Cygwin from a folders context menu

>> I'd like it to work before I reference it in the FAQ.

Fine!

> Well, it was some fiddeling.
> It worked well but now as I tried
> to reinstall, it doesn't work on
> mounted drives anymore:-(

I've done it some time ago. Here's what I did:

first I took a close look on how others where dooing it. Then created a 
file:
--- start of "bash-here.reg" ---
REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell\bashHere]
@="Shell: bash prompt here"

[HKEY_CLASSES_ROOT\Drive\shell\bashHere\command]
@="C:\\Programme\\Cygwin\\cygwin.bat \"%1\""


[HKEY_CLASSES_ROOT\Directory\shell\bashHere]
@="Shell: bash prompt here"

[HKEY_CLASSES_ROOT\Directory\shell\bashHere\command]
@="C:\\Programme\\Cygwin\\cygwin.bat \"%1\""
--- end of "bash-here.reg" ---


Next "cygwin.bat" was modified:
--- start of "cygwin.bat" ---
@echo off

C:
chdir \Programme\cygwin\bin
echo cd %1 | sed -e "s#\(.\):\(.*\)#/cygdrive/\1\2#" -e "s#\\\\#/#g" > 
%HOMEDRIVE%\.bashcd

bash --login -i
--- end of "cygwin.bat" ---


And last a change to "/etc/profile":
--- start of "/etc/profile" ---
PATH="/usr/local/bin:/usr/bin:/bin:$PATH"

USER="`id -un`"

# Set up USER's home directory
if [ -z "$HOME" ]; then
  HOME="/home/$USER"
fi

if [ ! -d "$HOME" ]; then
  mkdir -p "$HOME"
fi

export HOME USER

for i in /etc/profile.d/*.sh ; do
  if [ -f $i ]; then
    . $i
  fi
done

export MAKE_MODE=unix
export PS1='\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '

cd "$HOME"

test -f ./.bashrc && . ./.bashrc
test -f ./.bashcd && . ./.bashcd && rm -f $HOME/.bashcd
--- end of "/etc/profile" ---


Since I am using tcsh too, I've done it for tcsh too:
--- start of "tcsh-here.reg" ---
REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell\cshHere]
@="Shell: tcsh prompt here"

[HKEY_CLASSES_ROOT\Drive\shell\cshHere\command]
@="C:\\Programme\\cygwin\\bat\\tcsh.bat \"%1\""


[HKEY_CLASSES_ROOT\Directory\shell\cshHere]
@="Shell: tcsh prompt here"

[HKEY_CLASSES_ROOT\Directory\shell\cshHere\command]
@="C:\\Programme\\cygwin\\bat\\tcsh.bat \"%1\""
--- end of "tcsh-here.reg" ---


--- start of "tcsh.bat" ---
@echo off

C:
chdir \Programme\cygwin\bin
echo cd %1 | sed -e "s#\(.\):\(.*\)#/cygdrive/\1\2#" -e "s#\\\\#/#g" > 
%HOMEDRIVE%\.bashcd

tcsh -l
--- end of "tcsh.bat" ---

--- start of "/etc/csh.login" ---
#
# Example /etc/csh.login for Cygwin
#
unsetenv TEMP
unsetenv TMP

set path=( /usr/local/bin /usr/bin /bin $path )

if ( ! ${?USER} ) then
  set user="`id -un`"
endif
if ( ! ${?HOME} ) then
  set home=/home/$USER
endif
if ( ! -d "$HOME" ) then
  mkdir -p "$HOME"
endif

if ( ! ${?TERM} || "$TERM" == "unknown"  || "$tty" == "conin" ) then
  set TERM=linux
endif

setenv MAKE_MODE unix

umask 022

cd ~
if ( -f ".bashcd" ) then
  source ./.bashcd
  rm -f "$HOME/.bashcd"
endif
--- end of "/etc/csh.login" ---


For W2K cmd.exe it is less complicated. You only need registry settings 
since it is not neccessary to replace '\' with '/' and substitute 'c:' 
with '/cygdrive/c' and there is an option telling cmd.exe to execute a 
commandline given command, then go to interactive mode:
--- start of "cmd-here.reg" ---
REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell\DosHere]
@="Shell: CMD &prompt here"

[HKEY_CLASSES_ROOT\Drive\shell\DosHere\Command]
@="C:\\WINNT\\System32\\cmd.exe /k cd \"%1\""

[HKEY_CLASSES_ROOT\Directory\shell\DosHere]
@="Shell: CMD &prompt here"

[HKEY_CLASSES_ROOT\Directory\shell\DosHere\Command]
@="C:\\WINNT\\System32\\cmd.exe /k cd \"%1\""
--- end of "cmd-here.reg" ---


Neccessary changes for zsh I leave upto the reader ;-)

-- 
Thomas


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