Linux Today: Linux News On Internet Time.

More on LinuxToday

Regular expressions in Linux Bash and KSH Shells

Dec 09, 2012, 16:00 (0 Talkback[s])
(Other stories by Surendra Anne)

Many people thinks that RegExp is alien to Script and thinks that we have to depend on GREP or SED to use regexp extensively But from Version 3 of Bash we can use regular expression with out using grep or sed. This will save us lot of time and reduce no of lines of script we write. Lets take some example, I want to ask a user to enter "Yes" to do some activity depending on his input. He may end up with entering YES or Yes or YEs or some other form of YES or even just Y or y. Earlier versions of BASH and KSH we have to depend on grep to put a check on user input as shown below.

Complete Story