CLEARCASE_XPN not parsed as variable in clearcase command

前端 未结 1 1214
粉色の甜心
粉色の甜心 2020-12-06 23:02

I meet a problem that when I run clearcase command:

ct find . -branch \'brtype(my_branch)\' -exec \"echo %CLEARCASE_XPN%\"`

%CLEARCAS

相关标签:
1条回答
  • 2020-12-06 23:46

    Use:

    ct find . -branch 'brtype(my_branch)' -exec 'echo $CLEARCASE_XPN'
    

    %CLEARCASE_XPN% is a windows syntax.

    $CLEARCASE_XPN is the unix syntax, that you can use in your Linux tcsh session.

    See "cleartool find" and "Additional examples of the cleartool find command" for many examples using the unix syntax.


    Note also the use of simple quotes around the exec directive: -exec 'echo $CLEARCASE_XPN'.
    That will prevent the shell itself to interpret immediately the $CLEARCASE_XPN variable (which is unknow for the tcsh session) and will allow the cleartool find to pass the right value to the exec directive, replacing $CLEARCASE_XPN with the extended pathname.

    See "String quoting (single quote) vs. Weak Quoting (double quote)":

    • Strong quoting prevents characters from having special meanings, so if you put a character inside single quotes, what you see is what you get.
      Therefore, if you are not sure if a character is a special character or not, use strong quotation marks.

    • Weak quotation marks treat most characters as plain characters, but allow certain characters (or rather meta-characters) to have a special meaning. As the earlier example illustrates, the backslash within double quotation marks is a special meta-character.
      It indicates the next character is not, so it can be used before a backslash and before a double quotation mark, escaping the special meaning.
      There are two other meta-characters that are allowed inside double quotation marks: the dollar sign, and the back quote.

    0 讨论(0)
提交回复
热议问题