Re: stupid bash question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Aug 15, 2012 at 4:19 PM, Craig White <craig.white@xxxxxxxxxx> wrote:
> the relevant snippet is...
>
> NAME="*.mov"
> cd $IN
> if test -n "$(find . -maxdepth 1 -name $NAME -print -quit)"
>
> and if there is one file in this directory - ie test.mov, this works fine
>
> but if there are two (or more) files in this directory - test.mov, test2.mov
>
> then I get an error...
> find: paths must precede expression
>
> So my code is evidently wrong. I just want a test for 1 or more files ending in .mov in the directory?
>
> Any one want to toss me a bone here?

Run the script with -x to see what's happening. $NAME is probably
getting expanded. You might have to set noglob.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux