On Thu, Sep 18, 2014 at 4:31 PM, Chris Kottaridis <chriskot@xxxxxxxxxxxxx> wrote: > 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. Chris, Looks like you are really close. if [[ $val =~ ^[A-Fa-f0-9]+$ ]] ; then John -- 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