Mailinglist Archive: opensuse (686 mails)

< Previous Next >
Re: [opensuse] bash: how to get file extension
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Mon, 15 Jul 2013 11:30:10 +0200 (CEST)
  • Message-id: <alpine.LNX.2.00.1307151128550.2653@Telcontar.valinor>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Monday, 2013-07-15 at 11:21 +0200, Carlos E. R. wrote:
On Monday, 2013-07-15 at 11:01 +0200, lynn wrote:


But it can remove an extension if it is known in advance. And what you
want is getting the extension, right?

I found this:

# (from /usr/local/bin/rosegarden-audiofile-importer)

base=`basename "$infile"`
stem=${base%.*}
extension=${base##*.}

extension=`echo $extension | tr '[A-Z]' '[a-z]'`


I have not tested it.

- -- Cheers,
Carlos E. R.
(from 12.3 x86_64 "Dartmouth" at Telcontar)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEARECAAYFAlHjwSoACgkQtTMYHG2NR9VABQCfaMVQUnuNXQaYH4XfL+bCeLWq
0qQAmQGCJrFEppzziWWEmMoulmrpuBfT
=eRP3
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References