10.3.9 isUpperStr (verifies half-width uppercase character of the character string)
Syntax
isUpperStr character-string
Description
This command evaluates whether all character strings specified for argument consists of half-width uppercase characters.
This command outputs 1 in the following cases:
-
All characters are half-width uppercase characters
This command outputs 0.
-
Character string contains a letter that is not a half-width uppercase character
Arguments
- character-string
-
This command specifies the character string to be evaluated.
Output to the standard output
1 or 0.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
Not less than 1 |
Termination with an error |
Examples
isUpperStr ABC # "1" is output. isUpperStr abc # "0" is output. isUpperStr AbC # "0" is output. # Character string contains a letter that is not a half-width uppercase character, return 1. result=$(isUpperStr "$var1") if [[ $result -eq 0 ]]; then return 1 fi