I created an environment variable:
WD=`pwd`
How can I check if it contains spaces or non-English letters?
|
I created an environment variable:
How can I check if it contains spaces or non-English letters? |
||||
|
|
I presume that by “non-English letters” you mean letters other than the 26 unadorned letters of the Latin alphabet. Then, strictly speaking, here's a test that meets your requirements:
That is, strip the English letters and see if there are any letters or spaces left. I suspect that you're in fact trying to avoid all non-ASCII characters and all whitespace, including the ones that aren't letters such as
Note that ranges like If you're checking for “unusual” characters in files (why else exclude even spaces, which are allowed on most modern platforms), it might make sense to have a more restricted lists that doesn't allow any nonportable characters. POSIX only allows ASCII letters, digits and
|
|||||||
|
|
Regular expressions and We match any non-English letter or digit or
If may replace all correct symbols in So, if we are expecting only
|
|||||||||
|
|
|
|||
|
|
It seems pattern
|
|||
|
Bash can do its own pattern matching.
|
|||
|