This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: sed




--- Mike MacDonald <mmacdona@tsi.gte.com> wrote:
> Ok, well, sed won't let me strip a linefeed from the end of a line..  This
> is a little important because I'm trying to fix configure to install .exe
> files..  Is this a bash limitation, or is there a better sed out there I can
> use?

Try this:

 ----------------------< snip snip snip >--------------------------
     #! /bin/sh
     
     # file: install
     # author:  earnie                  email: earnie_boyd@hotmail.com
     #
     # Install Preprocessor for the gnuwin "make install" command.
     #
     # Purpose: 
     #   Automatically add the suffix .exe to filenames that require it
     #
     # To use:
     #   Copy this file earlier in the path than the default install.exe
     #   It is recommended that the original install.exe be renamed 
     #   cyg_install.exe as otherwise some configure programs may fail
     #   to find this install script
     #
     # Note:
     #   No warranty implicit or explicit is given.
     #   You may copy, distribute and use as you see fit.
     #   USE AT YOU OWN RISK.
     #
     # changed: M.Hirmke                email: mh@mike.franken.de
     #   changed ginstall to cyg_install, because some packages are looking
     #   for ginstall
     #
     # changed: Dr David Coe            email: david@coent.demon.co.uk
     #   "I seem to remember earnie's script gave trouble (in X11 or lesstif
     #    make install) when both <exec.exe> and <exec> are present
     #    simultaneously). The attached helped."
     #
     # changed: Dr Pierre A. Humblet    email: humblet@eurecom.fr
     #    Modify logic to work when several files are installed in a directory,
     #    some with the .exe extension and others without.
     #    Issue warning in case of ambiguity
     #    Search for an appropriate install.exe program
     
     tstr=""
     ambiguous=""
     while test $# -gt 1;
     do
       suffix=""
       if test -e "$1.exe";
       then
         if test \( -f "$1" -o -L "$1" \) -a \
                 \( "$(ls -ib "$1").exe" != "$(ls -ib "$1".exe)" \)
         then
           ambiguous="${ambiguous}'$1' '$1.exe' "
         else
           suffix=".exe"
         fi
       fi
       tstr="${tstr}'${1}${suffix}' "
       shift;
     done
     if test -d "$1"
     then
       suffix=""
     fi
     tstr="${tstr}'${1}${suffix}'"
     
     # Issue warning if needed
     if test "$ambiguous"
     then
       echo $0 Warning: ambiguous filenames. Specify '".exe"' if appropriate.
1>&2
       echo $0 "$ambiguous" 1>&2
     fi
     
     # use cyg_install[.exe] if found, otherwise use install.exe
     type cyg_install >/dev/null 2>&1
     if test "$?" = "0"
     then
       eval "cyg_install $tstr"
     else
       eval "install.exe $tstr"
     fi
     exit 
     ----------------------< snip snip snip >--------------------------

=====
Earnie Boyd <mailto:earnie_boyd@yahoo.com>
Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]