Sed command in makefile

前端 未结 1 1735
清酒与你
清酒与你 2021-01-27 17:02

I get a Input String from @read command in makefile.

@read -p \"Enter Web Url:\" weburl; \\

I want to use the weburl variable in m

相关标签:
1条回答
  • 2021-01-27 18:00

    Be careful with $ sign in Makefile, especially when used in a shell statement. You can replace your sed command with this:

    sed 's/^\(ServerName:\)$$/\1 '$$weburl'/' $(LOCALCONFIGDIR)/myfile.conf
    

    Note the end of the line is $$. Note also that variable substitution can't be done with single quote ', that's why the variable is outside of it.

    With some sed optimisation, I'd rather advise you this:

    sed "/^ServerName:/s/$$/ $$weburl/" $(LOCALCONFIGDIR)/myfile.conf
    
    0 讨论(0)
提交回复
热议问题