delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/14/15:14:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
X-Authentication-Warning: dragon.dn.rsc.raytheon.com: agrimm owned process doing -bs
Date: Thu, 14 Oct 2004 13:13:29 -0600 (MDT)
From: Andrew Grimm <agrimm AT redwood DOT rsc DOT raytheon DOT com>
X-X-Sender: agrimm AT dragon
To: cygwin AT cygwin DOT com
cc: d_inabox AT yahoo DOT com
Subject: Re: tcsh and chere-0.3-1
Message-ID: <Pine.GSO.4.44.0410141303430.6933-100000@dragon>
MIME-Version: 1.0
X-SPAM: 0.00

Igor Pechtchanski said:
> > Does anyone know of a way to get a `-` at the start of $0? I believe
> > this will force all the shells to start as login shells and is the
> > most generic solution.
>
> Sure.  'bash -c "exec -l $PROG $ARGS"'. :-)

Ya beat me to it :)  Although, in the current design, this would make a
bash shell call a login shell call a normal shell (for the cd) which is a
bit of a quoting nightmare.

You could make a support script (/bin/shere) that did somehting like this:

#!/bin/bash
# shere: run login shell arg1 in directory arg2
[ -x "$1" -a -d "$2" ] || exit 1;
dir=$(/bin/cygpath -u "$2")
exec -l $1 -c "cd \"$dir\"; exec $1"

Then the command you send would turn into something as simple as:

C:\cygwin\bin\rxvt.exe -e /bin/shere /bin/tcsh.exe '%L'

If you hate the idea of making another script (I do too) you could turn
chere into a bash script, and add an arg like "chere -e <shell> <dir>"
which runs the above.  Then chere would do its work by registering a call
to chere.

-Andy


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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