How To Check Uppercase String in Bash

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/check-uppercase-string-bash/
PINTEREST
PINTEREST
INSTAGRAM

We want to check if the string is uppercase. But the real difficulty is using bash. Bash have the ability to check this with operator.

  • password is ou bash variable that holds string

  • We use if else control statement.
  • The logic lines $password =~ [A-Z] . We provide a regex and check our variable with  ~ operator.
  • After check we print “Upper” or “Lower” according the situation

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/check-uppercase-string-bash/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Logrotate Command Tutorial With Examples For Linux

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)