this question has answer here:
i want able use grep variable , string combined searching.
test="http/[0-9].[0-9]" grep '$test [0-9][0-9][0-9] ||' some_file
tried put variable in ${test} did not help.
how can combine grep arguments variable , string?
you have enclose pattern in double quotes enable variable expansion :
test="http/[0-9].[0-9]" grep "$test [0-9][0-9][0-9] ||" some_file
test='expanded' echo '$test' # echo $test echo "$test" # echo expanded
Comments
Post a Comment