help-bash
[Top][All Lists]
Advanced

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

code not working ..


From: alex xmb sw ratchev
Subject: code not working ..
Date: Wed, 11 Sep 2024 00:25:15 +0200

i got in a script

ca=( "$@" )
  checkarg() {                                                           !
(( $# )) &&
return 1
local IFS=$'\xff \t\n' i a
i=${IFS:0:1}
 for a ; do
[[ ${ca[*]//"$i"/'^^'} == @(#|"$i")@("$a")@(%|"$i") ]] ||
return 1
 done
return 0
  }

checkarg 1 &&
exit

-- the script runs , but at checkarg 1 ( 1 is first and only arg to script
) fails at the [[ , not returning 0

-x says

+ ca=("$@")
+ checkarg 1
+ ((  1  ))
+ local 'IFS=�
' i a
+ i=$'\377'
+ for a in "$@"
+ [[ 1 == @(#|\�)@(\1)@(%|\�) ]]
+ return 1

but why doesnt it return null ?

its supposed to do : ( argslist , with arg '1' as check )
args list , flat , xff separator , with inside occurrence of xff
==
@(either beginning of whole || or xff )
"$a* ( arg loop to checkarg's args )
@(either end of all , or xff )

.. should return null
as in -x seen .. i think this should return null
.. at least i remember doing such things long ago ..

greets ..

is xff 377 ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]