The task is as follows: Turn the nginx config template file into a nginx config file. in the template there are such records as $ uri and so on.

the script uses only the variable $ user

The script considers them as variables and stupidly does not write to the file. Any ideas on how to get around this?

  • Rewrite the script? - Qwertiy

1 answer 1

you can, for example, “escape” the $ character by adding \ in front of it:

 $ sed 's/\$/\\$/g' файл > новый.файл 

and, if required, then remove this character before the $user line:

 $ sed 's/\$/\\$/g;s/\\\$user/$user/g' файл > новый.файл