Thursday, October 17, 2024

Re: clever grep..

On 13/10/2024 9:44 p.m., Mike Fischer wrote:
grep "return 301 $host$request_uri" *.conf

Hi,

I think you missed the point.

grep "return 301 $host$request_uri" *.conf    $host evaluates to the empty string  $request_uri evaluates to the empty string    resulting in:  grep "return 301 " *.conf    You want to put single quotes around the search string to eliminate the variable substitution.  grep 'return 301 $host$request_uri' *.conf    Note the single quote in front of the "return" and a single quote after the "uri".    I hope this clarifies.    Cheers,  Steve W.    

No comments:

Post a Comment