Hi and welcome to LinuxQuestions!
If you want to check for punctuation or spaces characters in general, you can use grep with the -E option and specify the proper character classes, e.g.
Code:
$ echo string | grep -E -q '[[:punct:]]|[[:space:]]' && echo yes || echo no
no
$ echo str,ing | grep -E -q '[[:punct:]]|[[:space:]]' && echo yes || echo no
yes
just to give you an idea. If you want to check for specific characters only, include them in a character list and eventually use the shell octal notation for special or control characters. For example to match a single backspace or space or comma:
Code:
$ echo string | grep -E $'\010''|[ ,]'
The part in blue is the shell notation for octal codes and it must be left outside the quotes that embed the rest of the grep pattern. Hope this helps.