From: Mikael Magnusson <mikachu@gmail.com>
To: meino.cramer@gmx.de
Cc: zsh-users@zsh.org
Subject: Re: if the file is not found the files is not found is the file not found
Date: Sun, 4 Mar 2012 15:37:32 +0100 [thread overview]
Message-ID: <CAHYJk3TEsrLmhKuoM9dRvM+dW2VM43DTFNaPv1gEt_MEigWXvQ@mail.gmail.com> (raw)
In-Reply-To: <20120304143102.GE18164@solfire>
On 4 March 2012 15:31, <meino.cramer@gmx.de> wrote:
> Hi,
>
> ... the cat has bitten into its own tail... somehow...
>
>
> I wrote a script which handles dvbt streamed files. The process
> creates some temporary files, which I want to remove afterwards,
> because they normally big ones.
>
> First I wrote
>
> rm -f ${f}-[0-9]*.mp2
>
> which breaks which an error, if the certain has not created files
> of that pattern ... despite the "-f" of the "rm" command.
>
> Then I treid to check for the existence of such files in beforehand
> this way:
>
> [ -f ${f}-[0-9]*.mp2 ]] && rm -f ${f}-[0-9]*.mp2
>
> . Which fails for the same reason.
>
> Did I get lost here? ;)
>
> How many cats do I need to get one, which does not bit into
> the tail of the next cat I enter into the script ?
>
> Who knows of the according dog to chase the cats away and make
> my script work? ;) :))
>
> Thanks a lot for any help in advance!
If you setopt extendedglob you can append (#qN) to the pattern to
suppress the error for that specific pattern, or setopt nullglob to
always do it. ie, it would be ${f}-[0-9]*.mp2(#qN)
--
Mikael Magnusson
next prev parent reply other threads:[~2012-03-04 14:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-04 14:31 meino.cramer
2012-03-04 14:36 ` Moritz Bunkus
2012-03-04 14:37 ` Mikael Magnusson [this message]
2012-03-04 18:37 ` Bart Schaefer
2012-03-04 18:48 ` Mikael Magnusson
2012-03-04 19:44 ` Bart Schaefer
2012-03-04 20:13 ` Mikael Magnusson
2012-03-04 21:47 ` Bart Schaefer
2012-03-05 0:48 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3TEsrLmhKuoM9dRvM+dW2VM43DTFNaPv1gEt_MEigWXvQ@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=meino.cramer@gmx.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).