Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #12564
| 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 | 2014-10-30 12:02 -0800 |
| Message-ID | <87wq7huy0l.fld@barrow.com> (permalink) |
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 | Next — Previous in thread | Find similar | Unroll 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