The book I am reading - Learning the Bash Shell by O'Reilly specifies some code as follows:if [ -n $(echo $1 | grep '^-[0-9][0-9]*$') ]; then    howmany=$1   shift   ....   ....   etcThis uses the grep search utility to test if $1 matches the appropriate pattern. To do this we provide the regular expression ^-[0-9][0-9]*$ to grep, which is interpreted as an initial dash followed by a digit, optionally followed by one or more digits. If a match is found then grep will return the match and the test will be true, otherwise grep will return nothing and processing will pass to the elif test. Notice that we have enclosed the regular expression in single quotes to stop the shell from interpreting the $ and *, and pass them through to grep unmodified.Then, why doesn't the regular expression '^-[0-9]' lose it's meaning as in single quotes, usually everything within single quotes loses it's meaning.Thank you for your help.
Regular expression within single quotes- lose their value?
regular expression;quoting
Single quotes tell the shell to keep the enclose characters as is, without any interpretation. The quoted string is passed as-is to grep, without the quotes: when grep looks for its arguments, it seesgrepand^-[0-9][0-9]*$and acts on that. (Read How programs get run if you're curious about argument construction in Linux.)bash and grep are different. The way this command uses quotes ensures that bash doesn't process the string, but grep does.