Make file echo displaying “$PATH” string

前端 未结 2 1549
借酒劲吻你
借酒劲吻你 2020-12-23 16:22

I am trying to force make file to display next string:

\"Please execute next commands:
setenv PATH /usr/local/greenhills/mips5/linux86:$PATH\"
2条回答
  •  渐次进展
    2020-12-23 17:00

    The make uses the $ for its own variable expansions. E.g. single character variable $A or variable with a long name - ${VAR} and $(VAR).

    To put the $ into a command, use the $$, for example:

    all:
      @echo "Please execute next commands:"
      @echo 'setenv PATH /usr/local/greenhills/mips5/linux86:$$PATH'
    

    Also note that to make the "" and '' (double and single quoting) do not play any role and they are passed verbatim to the shell. (Remove the @ sign to see what make sends to shell.) To prevent the shell from expanding $PATH, second line uses the ''.

提交回复
热议问题