[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] newbei Q
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] newbei Q |
Date: |
Fri, 25 Mar 2016 08:02:21 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Mar 24, 2016 at 05:22:41PM -0700, Seth David Schoen wrote:
> Val Krem writes:
> > unzip $f1/'*.zip'
>
> The general way would be to cd (or pushd) "$f1" before running unzip.
And check for success. Always.
> The unzip command also has a -d argument which lets you specify a
> directory where the output should go.
In addition to this, "$f1" should always be double-quoted. Since you
also want the * to be quoted (this is a unique property of unzip, which
originated in the MS-DOS world rather than the Unix world), you could
write it this way:
unzip -d "whatever" "$f1/*.zip"
With almost any other command, you would NOT want the glob to be quoted,
because you want the shell to expand it. In such cases, the variable
expansion should be quoted, but not the glob characters:
rm -f -- "$f1"/*.foobar