If tag_len is greater than 18 or tag_len is 19 and the tag is not ends with "A",
I want to cut the tag to length 18.
I tried several options but that is not working correctly. Could you let me now how I can do this?
#officail daily release TAG check
official_tag_len=18
export tag_len=`expr length $TAG`
if (($tag_len > $official_tag_len))
then
    echo "$TAG length is greater than $official_tag_len"
    if (($tag_len == ($official_tag_len+1))) && (($TAG == *A))
    then
        echo $TAG is an AM daily tag
    else
        echo $TAG is a temporary tag. reset to daily tag
        export TAG=$($TAG:0:$official_tag_len)
    fi
fi
UPDATE
the final error message is
e7e10_preqe2:0:18: command not found
I edit the code "export TAG=$($TAG:0:$official_tag_len)" referring to Extract substring in Bash
and one more thing, at first I wrote [[ instead of (( in if condition but command not found error occurs in [[ line.
Usually, I used [ ] expression in if condition. Are there any exceptional cases?
 
     
    