[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:
From: |
Greg Wooledge |
Subject: |
Re: |
Date: |
Mon, 22 Mar 2021 08:59:47 -0400 |
On Mon, Mar 22, 2021 at 09:50:06AM +0000, Budi wrote:
> in a function k() in ~/.bashrc
>
> k(){ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(.
> -regextype posix-extended "${b[@]}" -print); find "${c[@]}"
> }
>
> in output set -x:
>
> + unset u
> + h-0
This is clearly a falsehood. You didn't paste the actual output.
> + o=(${h:+ ! -path "./*.txt"})
> + u=($u "${o[@]}")
Why have the unquoted $u here when you know the variable is unset?
> + c=(. -regextype posix-extended "${b[@]}" -print)
What's in the array "b"? You never showed any such array.
> + find . -regextype posix-extended ' ! -path ./*.txt' -print
> find: paths must precede expression: ` ! -path ./*.txt'
>
> Why and how to solve ?
I think your real question is this one -- why did the exclamation point
and the word -path and the word ./*.txt all get squashed together into
a single word, instead of being inserted as three separate words?
If you can simplify your code down to *just* that case, and if you can
show an actual reproducer for it, then we might try to reproduce it
ourselves.
As it is now, I don't trust what you've written here, because you clearly
haven't been honest about it, and you haven't shown the actual commands
you ran ("set -x output" of what??), let alone the actual output.