unix bash shell 脚本相等比较运算符不比较

unix bash shell script equal comparison operator is not comparing

我有以下 bash 脚本。它通过

的目录结构进行查找
YYYY
+ MM
++ DD
+++ HH

我想跳过第 17 小时的目录 - 但是比较运算符

if [  $ARRVAL == "17" ]

不工作。我怎样才能做上面的比较?

#!/bin/bash
CURRENTDAY=`date +"%d"`
CURRENTHOUR=`date +"%H"`

#date +"%m-%d-%y"
#$now = "$(date + '%Y%d%m%k%M')";
echo TIME IS: "$CURRENTDAY $CURRENTHOUR"
echo blablaba


for D in `find . -type d`
do
    
    t=$D
    a=($(echo "$t" | tr '/' '\n'))
    #echo "${a[4]}"

    #echo ----------- Directory  $D 
    IFS='/' read -r -a array <<< "$D"
    #echo array has_"${#array[@]}"_elements

    if [ "${#array[@]}" = "5" ]
    then
       echo TESTING $D  comparing  ${array[4]} and $CURRENTHOUR
       ARRVAL="${#array[4]}"
       
       #if [  "${#array[@]}" == "17" ]
       if [  $ARRVAL == "17" ]
       then
            echo current hour       
       fi
    fi
    # if [ "${#array[@]}" = "5"]
    # then
    #     echo $D has 5 elements
    # fi

完成

I would like to skip the directory in the 17th hour

find . -mindepth 4 -maxdepth 4 -type d '!' -path './*/*/*/17'

应该够了。