Perl validating numbers
They can be and often are used simultaneously: Generally, it is better to initialize most variables explicitly.
I know it is difficult as old habits die slowly, but this can be done.
Recently it was also extended to case conversion using ^^ and ,, digrams This "ksh-originated" group of operators is the most popular and probably the most widely used group of string-handling operators so it makes sense to learn them, if only in order to be able to modify old scripts.
that can be used instead in many cases and they are definitely preferable in new scripts that you might write.
Anyway, standard functions like length, index, substr are available.
Strings can be concatenated by juxtaposition and using double quoted strings.
Modern shells such as bash 3.x or ksh93 supports most of the standard string manipulation functions, but in a very pervert, idiosyncratic way.
You can ensure that variables exist (i.e., are defined and have non-null values) and set default values for variables and catch errors that result from variables not being set. There are several basic string operations available in bash, ksh93 and similar shells: Shell string processing capabilities were weak, but recently in bash 4.x they were improve and how are half-decent.
Most "classic" string handing function such as index, substr, concatenation, trimming, case conversion, translation of one set of symbols into another, etc, are available. Regular expression now can be used for matching the string using Perl compatible regex pattern. Almost ;-) One interesting idiosyncrasy of Unix shells including bash is that many string operators in shell use unique among programming languages curly-bracket syntax. This notation was initially introduced to protect a variable name from merging with string that comes after it, but was extended to allow string operations on variables.
Despite shell deficiencies in this area and idiosyncrasies preserved from 1970th most classic string operations can be implemented in shell.
You can define functions that behave almost exactly like in Perl or other "more normal" language.The minor differences are the treatment of escaped characters and new line character. echo $' Three form feeds \f \f \f' echo $'10 newlines \n\n\n\n\n\n\n\n\n\n' echo $'2130' # Bash # Octal equivalent of characters.