delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/26/05:34:08

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-VirusChecked: Checked
Date: Tue, 26 Jun 2001 10:38:17 +0100
From: "malcolm.boekhoff" <malcolm DOT boekhoff AT actfs DOT co DOT uk>
To: Cygwin News Group <cygwin AT sources DOT redhat DOT com>
Subject: How to extract suffix from a filename?
Message-ID: <20010626103817.A221@BOEKHOFF_M>
Mime-Version: 1.0

Okay, it's a silly question - how can I extract the suffix from a file
name (I know I can use "basename" and "dirname" to get the file and
directory components)?

Read the rest of this mail message if you can be bothered.

I want to do this because my script executed from my .mailcap file in
mutt spawns off internet explorer or word or whatever other GUI thing is
required to read attachments like ".doc" and ".pps", etc. and I can keep
reading mail in mutt asynchronously.  To make this work I need to copy
the temporary file created by mutt and sometimes maybe this needs to end
in ".doc" and I would rather not hard-code the suffix in the script,
because, maybe somtimes, say for image/* mimetype, the suffix could be
".jpg" or ".tiff", etc. and maybe the invocation of IE5 requires the
target to end in ".jpg" or ".tiff" and it probably isn't right for me to
copy the "source.tiff" to "target.jpg" and start IE5 on the target.
Maybe.

I would like to use the suffix on the file supplied by mutt here,
instead of hard coding it.                                   |
                                                             |
                                                             |
                                                             |
                                            +----------------+
..                                         |
            application/vnd.ms-excel)       v
                TMPFILE=`mktemp $TEMPLATE`.xls
                COMMAND="/c/program\ files/microsoft\ office/office\
/excel \"`cygpath -a -w \"$TMPFILE\"`\"&"
            ;;
..
cp -fp "$SRCFILE" "$TMPFILE"
eval $COMMAND

***********************************************************************
This message has been checked for all known viruses by the
E-mail Virus Protection service, powered by MessageLabs.
***********************************************************************

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