This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
RE: Ultimative way to start Windows NT/2000 programs from bash
- To: "'klaus dot berndl at sdm dot de'" <klaus dot berndl at sdm dot de>, Joerg dot Schaible at gft dot com, cygwin at sourceware dot cygnus dot com
- Subject: RE: Ultimative way to start Windows NT/2000 programs from bash
- From: Heribert Dahms <heribert_dahms at icon-gmbh dot de>
- Date: Mon, 13 Nov 2000 22:57:12 +0100
Hi Klaus,
what about using $COMSPEC wrapped in cygpath
instead of hardcoding cmd to allow 9x again?
(Not that I'd like to use anything than NT 8-)
Bye, Heribert (heribert_dahms@icon-gmbh.de)
> -----Original Message-----
> From: klaus.berndl@sdm.de [SMTP:klaus.berndl@sdm.de]
> Sent: Monday, November 13, 2000 15:08
> To: Joerg.Schaible@gft.com; cygwin@sourceware.cygnus.com
> Subject: AW: Ultimative way to start Windows NT/2000 programs
> from bash
>
> > My be you should remove now 95 and 98 from the subject <g>.
>
> Has been done.
>
> > What about other
> > executables or script files identified by PATHEXT ?
>
> Yes, good point! here is the next iteration (the last one i hope :-)
>
> # open any file in the correct program: an associated file-type (see
> assoc
> # and ftype at Windows NT/2000) will be opened with the associated
> program.
> # Not associated filetypes and files which extension is contained in
> # $PATHEXT will be opened in the texteditor (here Emacs). Files with
> # extension .exe and .com will not be opened!
>
> function open-file-with-w32 () {
> for i in $*; do
> if [ -f "$i" ]; then
> # get the extension only
> erg=`echo $i | sed -e 's|.*\.||g;'`
> # check if we try to open a program
> if [ "$erg" != "exe" ] &&
> [ "$erg" != "EXE" ] &&
> [ "$erg" != "com" ] &&
> [ "$erg" != "COM" ]; then
> # check if we try to open a file with a extension from
> $PATHEXT
> is_path_ext=`echo "$PATHEXT"\; | grep -i "\.$erg;"`
> if [ "$is_path_ext" == "" ]; then
> # check if this extension is associated with a
> w32-program
> erg=`cmd /x /c assoc ".$erg" 2>/dev/null`
> if [ "$erg" != "" ]; then
> # an associtiation exists therefore this call
> should
> # theoretically not produce amn error.
> cmd /x /c start /b `cygpath -w "$i"`
> 2>/dev/null
> else
> # we must open the file with a text editor
> because
> # it is not associated.
> emacs `cygpath -w "$i"`
> fi
> else
> # files with a extension contained in $PATHEXT
> will be
> # opened with the text editor.
> emacs `cygpath -w "$i"`
> fi
> else
> echo "$i is a program!"
> fi
> fi
> done
> unset erg is_path_ext; }
> alias o=open-file-with-w32
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com