Subject: | |
From: | |
Reply To: | |
Date: | Wed, 26 Oct 2005 17:08:08 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
John MacLerran wrote:
>specifically, the alpha function on mpe works on a string, but the grep
>command expects a file as its input. i'm not sure how to: 1) grep for alpha
>only characters (i'm thinking that something like [A-Z | a-z] is needed, but
>i'm not sure of the exact syntax), and 2)get grep to look at a string and
>evaluate just that string. can anyone give some pointers?
>
>
function isalpha {
echo "$@" | grep -Eiqe '^[A-Z]+$'
}
testword="hello"
if isalpha $testword
then
echo $testword is all alphabetic
else
echo $testword is not all alphabetic
fi
storedbool=$(isalpha $testword; echo $?)
if [ $storedbool -eq 0 ]
then
echo $testword is all alphabetic
else
echo $testword is not all alphabetic
fi
testword="hello2"
if isalpha $testword
then
echo $testword is all alphabetic
else
echo $testword is not all alphabetic
fi
storedbool=$(isalpha $testword; echo $?)
if [ $storedbool -eq 0 ]
then
echo $testword is all alphabetic
else
echo $testword is not all alphabetic
fi
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|