FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-28-2010, 06:12 PM
Christian Jaeger
 
Default Shell Expansion in Bourne Shell Script Question

> for MAGFILE in $MAGDIR/*.zip

Don't forget the double quotes around variable references. It's better
to always do that by default than to fix it afterwards (either because
you feed it paths with whitespace in them yourself at some point or
because someone else is trying to close the safety holes after you
publish such a script).

for MAGFILE in "$MAGDIR"/*.zip


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTin_hPc13Qs6QjjgNyuLPw6=nThqm6oXH8iFL-8F@mail.gmail.com">http://lists.debian.org/AANLkTin_hPc13Qs6QjjgNyuLPw6=nThqm6oXH8iFL-8F@mail.gmail.com
 
Old 07-28-2010, 09:58 PM
Mart Frauenlob
 
Default Shell Expansion in Bourne Shell Script Question

On 28.07.2010 20:05, Karl Vogel wrote:

On 28.07.2010 14:42, Jochen Schulz wrote:


J> I think you meant to write
J> for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`
J> Another hint: you don't need 'ls' for your case at all.

I'd recommend keeping the "ls". Try your script when MAGDIR doesn't
have any zipfiles, and MAGFILE will hold the expanded value of $MAGDIR
with the string "*.[Zz][Ii][Pp]" appended. Bash, sh, and ksh all do
that for some dopey reason, which is why I would do

for file in $(ls $MAGDIR/*.[Zz][Ii][Pp] 2> /dev/null); do ...

if there's any chance that you won't find any files.



Now that's an odd one! Didn't know that.
One might be better of with some like this:

find /DIR -regextype posix-egrep -regex '.*.(zip|ZIP)' -exec
some_command {} +



Best regards

Mart


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4C50A7F3.9040502@chello.at">http://lists.debian.org/4C50A7F3.9040502@chello.at


Thu Jul 29 00:30:02 2010
Return-path: <devel-bounces@lists.fedoraproject.org>
Envelope-to: tom@linux-archive.org
Delivery-date: Thu, 29 Jul 2010 00:15:39 +0300
Received: from bastion02.fedoraproject.org ([209.132.181.3]:47146 helo=bastion.fedoraproject.org)
by s2.java-tips.org with esmtp (Exim 4.69)
(envelope-from <devel-bounces@lists.fedoraproject.org>)
id 1OeDyV-00060h-43
for tom@linux-archive.org; Thu, 29 Jul 2010 00:15:39 +0300
Received: from lists.fedoraproject.org (collab1.vpn.fedoraproject.org [192.168.1.21])
by bastion02.phx2.fedoraproject.org (Postfix) with ESMTP id C5EF7110774;
Wed, 28 Jul 2010 22:00:06 +0000 (UTC)
Received: from collab1.fedoraproject.org (localhost.localdomain [127.0.0.1])
by lists.fedoraproject.org (Postfix) with ESMTP id 85C083267A7;
Wed, 28 Jul 2010 22:00:05 +0000 (UTC)
X-Original-To: devel@lists.fedoraproject.org
Delivered-To: devel@lists.fedoraproject.org
Received: from smtp-mm3.fedoraproject.org (smtp-mm3.fedoraproject.org
[152.46.7.226])
by lists.fedoraproject.org (Postfix) with ESMTP id F00DE32679E
for <devel@lists.fedoraproject.org>;
Wed, 28 Jul 2010 22:00:02 +0000 (UTC)
Received: from mail-wy0-f173.google.com (mail-wy0-f173.google.com
[74.125.82.173])
by smtp-mm3.fedoraproject.org (Postfix) with ESMTP id 3DCFF37DAD
for <devel@lists.fedoraproject.org>;
Wed, 28 Jul 2010 22:00:02 +0000 (UTC)
Received: by wyi11 with SMTP id 11so4428855wyi.32
for <devel@lists.fedoraproject.org>;
Wed, 28 Jul 2010 15:00:01 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.175.143 with SMTP id z15mr11269611wel.64.1280354401491;
Wed, 28 Jul 2010 15:00:01 -0700 (PDT)

Received: by 10.216.180.7 with HTTP; Wed, 28 Jul 2010 15:00:01 -0700 (PDT)
In-Reply-To: <1280353120.20253.4.camel@vaioz.local.net>
References: <4C4F554C.7030103@gmail.com> <4C4F5760.9070106@gmail.com>
<alpine.LFD.2.00.1007271707380.2911@laptop1.mmcgra th.net>
<4C4F5989.500@gmail.com>
<AANLkTimFnf1bXyZyt4feNsdAaR_0nRyJc3DuzcYN2wsZ@mai l.gmail.com>
<4C501A38.2000100@louiz.org>
<alpine.LFD.2.00.1007280746560.2546@laptop1.mmcgra th.net>
<4C502AEE.2090708@louiz.org>
<20100728153701.GF16445@victoria.internal.frields. org>
<1280337035.2038.18.camel@adam.local.net>
<4C5072B1.3020207@redhat.com>
<alpine.LFD.2.00.1007281324450.2546@laptop1.mmcgra th.net>
<4C507A03.7000107@redhat.com>
<alpine.LFD.2.00.1007281342080.2546@laptop1.mmcgra th.net>
<AANLkTi=nDKyD1-maC9QgtGCeXnHOxBmfxo-DhmAbbLL_@mail.gmail.com>
<alpine.LFD.2.00.1007281354110.2546@laptop1.mmcgra th.net>
<AANLkTinVVomCzN6N9pYjCDJx5L8shSj=dP67zrsDcAxa@mai l.gmail.com>
<AANLkTikhoPX1D4cjJD5g_24n9v27WbFENWpPr7jecbB=@mai l.gmail.com>
<4C5099EC.6020509@redhat.com>
<1280352534.2759.113.camel@localhost.localdomain >
<1280353120.20253.4.camel@vaioz.local.net>
Date: Wed, 28 Jul 2010 17:00:01 -0500
Message-ID: <AANLkTin4T7FTY02k0tnK+XA7SYuRBVzHT=KfXVk6o1dP@mai l.gmail.com>
Subject: Re: Firefox 4 for Fedora 14?
From: =?ISO-2022-JP?B?Q29uYW4gS3VkbyAoGyRCJUshPCVrISYlNCVzJVEbKEIp? =
<ngompa13@gmail.com>
To: Development discussions related to Fedora <devel@lists.fedoraproject.org>
X-BeenThere: devel@lists.fedoraproject.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: Development discussions related to Fedora
<devel@lists.fedoraproject.org>
List-Id: Development discussions related to Fedora
<devel.lists.fedoraproject.org>
List-Unsubscribe: <https://admin.fedoraproject.org/mailman/listinfo/devel>,
<mailto:devel-request@lists.fedoraproject.org?subject=unsubscrib e>
List-Archive: <http://lists.fedoraproject.org/pipermail/devel>
List-Post: <mailto:devel@lists.fedoraproject.org>
List-Help: <mailto:devel-request@lists.fedoraproject.org?subject=help>
List-Subscribe: <https://admin.fedoraproject.org/mailman/listinfo/devel>,
<mailto:devel-request@lists.fedoraproject.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1883368148581617699=="
Sender: devel-bounces@lists.fedoraproject.org
Errors-To: devel-bounces@lists.fedoraproject.org

--===============1883368148581617699==
Content-Type: multipart/alternative; boundary=001485f1e2ee4999c3048c79bda4

--001485f1e2ee4999c3048c79bda4
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Jul 28, 2010 at 4:38 PM, Adam Williamson <awilliam@redhat.com>wrote:


On Wed, 2010-07-28 at 23:28 +0200, Martin Sourada wrote:

> Speaking of which, is there any chance to split ffmpeg into free (which
> could be included in fedora) and nonfree part? IIRC we've done something
> like that with xine-lib-extras and gst-plugins-bad in the past...

ffmpeg, unfortunately, isn't set up to be modularised like this; you
can't build an ffmpeg-free with the free codecs and an ffmpeg-patented
with the patented ones and have them co-exist nicely. So an ffmpeg build
with almost all the codecs ripped out in the Fedora repos would
'compete' with the full build in That Other Repo, not complement it, and
the way the two repos are set up, it would be tricky to have a
handicapped build in the Fedora repo and a full build in That Other One
and have it easy for people to pick the one from That Other Repo (since
Other Repo packages use the same disttag as Fedora ones).
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Fedora Talk: adamwill AT fedoraproject DOT org
http://www.happyassassin.net



That is assuming that "the other repo" uses the same name as Fedora's.
Fedora could call it ffmpeg-free, and "the other repo" could call it
ffmpeg-nonfree, and have the nonfree one obsolete the free one. Simple fix,
I think.

--001485f1e2ee4999c3048c79bda4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 28, 2010 at 4:38 PM, Adam Williamson <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:awilliam@redhat.com">awilliam@redhat .com</a>&gt;</span> wrote=
:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class=3D"im">On Wed, 2010-07-28 at 23:28 +0200, Martin Sourada wrote:<=
br>
<br>
&gt; Speaking of which, is there any chance to split ffmpeg into free (whic=
h<br>
&gt; could be included in fedora) and nonfree part? IIRC we've done som=
ething<br>
&gt; like that with xine-lib-extras and gst-plugins-bad in the past...<br>
<br>
</div>ffmpeg, unfortunately, isn't set up to be modularised like this; =
you<br>
can't build an ffmpeg-free with the free codecs and an ffmpeg-patented<=
br>
with the patented ones and have them co-exist nicely. So an ffmpeg build<br=



with almost all the codecs ripped out in the Fedora repos would<br>
'compete' with the full build in That Other Repo, not complement it=
, and<br>
the way the two repos are set up, it would be tricky to have a<br>
handicapped build in the Fedora repo and a full build in That Other One<br>
and have it easy for people to pick the one from That Other Repo (since<br>
Other Repo packages use the same disttag as Fedora ones).<br>
<div class=3D"im">--<br>
Adam Williamson<br>
Fedora QA Community Monkey<br>
IRC: adamw | Fedora Talk: adamwill AT fedoraproject DOT org<br>
<a href=3D"http://www.happyassassin.net" target=3D"_blank">http://www.happy=
assassin.net</a><br>
<br></div></blockquote><div><br></div><div>That is assuming that &quot;the =
other repo&quot; uses the same name as Fedora's. Fedora could call it f=
fmpeg-free, and &quot;the other repo&quot; could call it ffmpeg-nonfree, an=
d have the nonfree one obsolete the free one. Simple fix, I think.=A0</div>
</div>

--001485f1e2ee4999c3048c79bda4--

--===============1883368148581617699==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
--===============1883368148581617699==--
 
Old 07-29-2010, 12:32 AM
 
Default Shell Expansion in Bourne Shell Script Question

>> On Wed, 28 Jul 2010 23:58:11 +0200,
>> Mart Frauenlob <mart.frauenlob@chello.at> said:

M> One might be better of with some like this:
M> find /DIR -regextype posix-egrep -regex '.*.(zip|ZIP)' -exec
M> some_command {} +

If the filelist is potentially too big for the max argument list on the
system, I would do something like this:

find $MAGDIR -print | grep -i '.zip$' | tr0 | xargs -0 some command

We have a ton of filenames with spaces and other crap, so "tr0" just
replaces newlines with nulls:

#!/bin/sh
PATH=/bin:/usr/bin
export PATH
exec tr '12' '00'
exit 1

--
Karl Vogel I don't speak for the USAF or my company

Q. Why are New Yorkers always depressed?
A. The light at the end of the tunnel is New Jersey. --Fredrick Homan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100729003203.9667CBED9@kev.msw.wpafb.af.mil">htt p://lists.debian.org/20100729003203.9667CBED9@kev.msw.wpafb.af.mil
 
Old 07-29-2010, 01:04 AM
Cameron Hutchison
 
Default Shell Expansion in Bourne Shell Script Question

vogelke+debian@pobox.com (Karl Vogel) writes:

>>> On Wed, 28 Jul 2010 23:58:11 +0200,
>>> Mart Frauenlob <mart.frauenlob@chello.at> said:

>M> One might be better of with some like this:
>M> find /DIR -regextype posix-egrep -regex '.*.(zip|ZIP)' -exec
>M> some_command {} +

> If the filelist is potentially too big for the max argument list on the
> system, I would do something like this:

> find $MAGDIR -print | grep -i '.zip$' | tr0 | xargs -0 some command

find $MAGDIR -iname '*.zip' -print0 | xargs -0 some-command

-iname matches names case insensitively. Since you then dont need grep,
you also dont need tr0.



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 788e.4c50d39b.7c987@getafix.xdna.net">http://lists.debian.org/788e.4c50d39b.7c987@getafix.xdna.net
 

Thread Tools




All times are GMT. The time now is 03:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org