In a bash shell script I want to see if a string has nothing but
hexadecimal values in it.
So:
A098FE or af098fe
should be true
hello
should not.
How do I check for that ?
I've been playing with
if [[ $val =~ '/^[A-Fa-f0-9]+$/' ]] ; then
echo is hex
else
echo is not hex
fi
I've tried various incantations of above and also tried using grep but
can't seem to get it just right.
Any help appreciated.
Thanks
Chris Kottaridis
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org