Home > OS >  Bash compare if two strings match by length [duplicate]
Bash compare if two strings match by length [duplicate]

Time:10-03

I have two string variables that I need to compare by length inside of if. So I need to do something like this:

if [ length($string_one) != length($string_two) ]:

fi

CodePudding user response:

if [[ ${#string} != ${#string_two} ]]; then
    run command
fi
  • Related