Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #12564

Re: Programs to convert *.xbm to *.gif for RHEL 6.5?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.gcicommunications!news.posted.gcicommunications.POSTED!not-for-mail
NNTP-Posting-Date Thu, 30 Oct 2014 15:02:22 -0500
Newsgroups comp.os.linux.misc
Subject Re: Programs to convert *.xbm to *.gif for RHEL 6.5?
References <abf4e2bf-57b7-4765-9e4b-49579ec4f7c1@googlegroups.com> <v5udnYhmXaqz5s_JnZ2dnUU7-TudnZ2d@giganews.com>
From floyd@apaflo.com (Floyd L. Davidson)
Organization __________
Date Thu, 30 Oct 2014 12:02:18 -0800
Message-ID <87wq7huy0l.fld@barrow.com> (permalink)
User-Agent gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.19
Cancel-Lock sha1:r9Cm7TC1znmJnCbduESnbg6Tdoo=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 42
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 24.237.125.254
X-Trace sv3-2ZQ3q+/VctirsQ8phvkBktrOr1EfgJoS8+PlALbkMeG08qzyLvQlzFnbHrbDDtGbZs38TRv/ziYHY/R!8xc/5tW+o9uFnMwfgkvKfeoByOtpnspdZJV4zLFdKgbb116Ay+DdjuWY1PxLWY+pmbcCjSpW
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2121
Xref csiph.com comp.os.linux.misc:12564

Show key headers only | View raw


Robert Heller <heller@deepsoft.com> wrote:
>At Thu, 30 Oct 2014 08:28:42 -0700 (PDT) Steve <tinker123@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm on RHEL 6.5
>>
>> Can anyone suggest a program that will convert a directory full of *.xbm files to *.gif files?
>>
>> Thank you
>
>Assumes you have done 'sudo yum install ImageMagick' first.
>
>#!/bin/bash
>for xbm in *.xbm ; do
>   gif=`basename $xbm`.gif
>   convert $xbm $gif
>done

Do you really want to rename foobar.xbm to foobar.xbm.gif,
or should it be to foobar.gif?

The command "basename $xbm" in that context is a no op.
This will do what you want:

  gif="$(basename $xbm xbm)gif"

But, really, this is much better:

  gif="${xbm%%xbm}gif"

Hence, with an eye to defensive programming:

#!/bin/bash
for x in *.xbm ; do
   convert "${x}" "${x%%xbm}gif"
done


-- 
Floyd L. Davidson                         http://www.apaflo.com/
Ukpeagvik (Barrow, Alaska)                      floyd@apaflo.com

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Programs to convert *.xbm to *.gif for RHEL 6.5? Steve <tinker123@gmail.com> - 2014-10-30 08:28 -0700
  Re: Programs to convert *.xbm to *.gif for RHEL 6.5? Rich <rich@example.invalid> - 2014-10-30 16:52 +0000
  Re: Programs to convert *.xbm to *.gif for RHEL 6.5? floyd@apaflo.com (Floyd L. Davidson) - 2014-10-30 09:41 -0800
    Q: graphicsmagick "Chester A. Arthur" <deadprez@whitehouse.com> - 2014-10-30 13:04 -0500
  Re: Programs to convert *.xbm to *.gif for RHEL 6.5? Robert Heller <heller@deepsoft.com> - 2014-10-30 12:53 -0500
    Re: Programs to convert *.xbm to *.gif for RHEL 6.5? floyd@apaflo.com (Floyd L. Davidson) - 2014-10-30 12:02 -0800

csiph-web