Prev: on failure
Next: In the Bible: the foreign women are prostitutes, crooked, evil, unfaithful, robbers etc
From: RensFunHog on 20 Jan 2010 12:44 How can I exclude a fileName within a For Do script? for x in A.log B.txt NOT C.log do <<taskHERE>> done I am scanning a single directory and if the fileName has string 'someName' I want to exclude it from the For statement. Thanks...
From: Ed Morton on 20 Jan 2010 12:53 On Jan 20, 11:44 am, RensFunHog <pbars...(a)gmail.com> wrote: > How can I exclude a fileName within a For Do script? > > for x in A.log B.txt NOT C.log > > do > <<taskHERE>> > > done > > I am scanning a single directory and if the fileName has string > 'someName' I want to exclude it from the For statement. > > Thanks... Assuming "has" means "includes" rather than "is": case $x in *someName* ) # skip it ;; * ) ...do what you want... ;; esac In general, though, if you're writing a shell loop to do something other than work with processes or create/move/remove files you're probably on the wrong track. Ed.
From: Barry Margolin on 20 Jan 2010 12:53 In article <440aa6aa-9b70-44cc-a4cf-5fd29f6978d4(a)p8g2000yqb.googlegroups.com>, RensFunHog <pbarstad(a)gmail.com> wrote: > How can I exclude a fileName within a For Do script? > > for x in A.log B.txt NOT C.log > > do > <<taskHERE>> > > done > > > I am scanning a single directory and if the fileName has string > 'someName' I want to exclude it from the For statement. > > Thanks... for x in *.log *.txt do case "$x" in *someName*) ;; *) <<taskHERE>> ;; esac -- Barry Margolin, barmar(a)alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***
From: Janis Papanagnou on 20 Jan 2010 15:22 RensFunHog wrote: > How can I exclude a fileName within a For Do script? If you're using Kornshell... for x in !(C.log) do : done Janis > > for x in A.log B.txt NOT C.log > > do > <<taskHERE>> > > done > > > I am scanning a single directory and if the fileName has string > 'someName' I want to exclude it from the For statement. > > Thanks...
From: Seebs on 20 Jan 2010 16:14 On 2010-01-20, RensFunHog <pbarstad(a)gmail.com> wrote: > How can I exclude a fileName within a For Do script? > > for x in A.log B.txt NOT C.log > > do ><<taskHERE>> > > done > > > I am scanning a single directory and if the fileName has string > 'someName' I want to exclude it from the For statement. No, you don't. You want to exclude it from task. case $x in *someName*) continue;; esac -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
|
Next
|
Last
Pages: 1 2 Prev: on failure Next: In the Bible: the foreign women are prostitutes, crooked, evil, unfaithful, robbers etc |