The conditional variable not work in function in a script ie ~/.bashrc
while works in shell term.

$ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(.
-regextype posix-extended "${b[@]}" -print); find "${c[@]}"

or type

$ k(){ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}");
c=(. -regextype posix-extended "${b[@]}" -print); find "${c[@]}" ;}

$ k
works

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
+ o=(${h:+ ! -path "./*.txt"})
+ u=($u "${o[@]}")
+ c=(. -regextype posix-extended "${b[@]}" -print)
+ find . -regextype posix-extended ' ! -path ./*.txt' -print
find: paths must precede expression: ` ! -path ./*.txt'

Why and how to solve ?

  • [no subject] Budi

Reply via email to