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: From: floyd@apaflo.com (Floyd L. Davidson) Organization: __________ Date: Thu, 30 Oct 2014 12:02:18 -0800 Message-ID: <87wq7huy0l.fld@barrow.com> 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 Robert Heller wrote: >At Thu, 30 Oct 2014 08:28:42 -0700 (PDT) Steve 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