Is there any function in shell that enable to check for upper or lower case? i would like to check the input argumnets for upper or lower case.
picass0
0
Light Poster
Recommended Answers
Jump to PostPerhaps use case/esac with a pattern of [a-z]+
Jump to PostTry this:
function test_upper { test=`echo $1 | grep [A-Z]` if [ "$?" = "0" ]; then #Uppercase letters found. #translate to lower case: echo $test | tr '[A-Z]' '[a-z] else #letters are all lowercase, return them. echo $1 fi }
Not exactly sure what you want …
All 6 Replies
Salem
5,138
Posting Sage
omrsafetyo
3
Junior Poster in Training
picass0
0
Light Poster
picass0
0
Light Poster
omrsafetyo
3
Junior Poster in Training
ghostdog74
57
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.