hello,
is this test ok - I need to check and be sure user name on a list for creation has only alphanumeric...
echo $X|awk '$1 !~ /^[[:alnum:]]+$/ {print "notalnum"}'
such test confirms but... is this test 100% ok?
Code:
$ for i in '$' '_' '%' '^' 1321 bsjs fkljs;do for y in 2786yqweughqk;do [[ -z `echo $y$i|awk '$1 !~ /^[[:alnum:]]+$/ {print "notalnum"}'` ]] && echo $y$i is alnum || echo $y$i is not alnum;done;done
2786yqweughqk$ is not alnum
2786yqweughqk_ is not alnum
2786yqweughqk% is not alnum
2786yqweughqk^ is not alnum
2786yqweughqk1321 is alnum
2786yqweughqkbsjs is alnum
2786yqweughqkfkljs is alnum
$