On Thu, Sep 18, 2014 at 4:31 PM, Chris Kottaridis
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 [[ $va
On Thu, 2014-09-18 at 16:31 -0500, Chris Kottaridis wrote:
> if [[ $val =~ '/^[A-Fa-f0-9]+$/' ]] ; then
> echo is hex
> else
> echo is not hex
> fi
You don't need the / or '
Also, this isn't searching for any hex string, it's searching for lines
consisting only of a single hex string.
po
try this:
if [[ $VAL2 =~ ^[A-Fa-f0-9]*$ ]] ; then
echo is hex
else
echo is not hex
fi
2014-09-18 17:34 GMT-05:00 Fred Smith :
> On Thu, Sep 18, 2014 at 04:31:03PM -0500, Chris Kottaridis wrote:
>> In a bash shell script I want to see if a string has nothing but
>> hexadecimal values in
On Thu, Sep 18, 2014 at 04:31:03PM -0500, Chris Kottaridis 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 wit
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 tr