CLEARCASE_XPN在clearcase命令中未解析为变量 [英] CLEARCASE_XPN not parsed as variable in clearcase command
问题描述
我遇到一个问题,当我运行clearcase命令时:
I meet a problem that when I run clearcase command:
ct find . -branch 'brtype(my_branch)' -exec "echo %CLEARCASE_XPN%"`
%CLEARCASE_XPN%
未解析为变量,输出为:
%CLEARCASE_XPN%
not parsed as a variable and the output is:
%CLEARCASE_XPN%
%CLEARCASE_XPN%
%CLEARCASE_XPN%
...
但是我确定 CLEARCASE_XPN
是该变量表示找到的文件的整个路径。
有人可以帮忙吗?操作系统是linux,外壳是tcsh,谢谢!
But I'm sure CLEARCASE_XPN
is the variable denotes the whole path of the found file.
Can anybody help? OS is linux, shell is tcsh, thanks!
推荐答案
使用:
ct find . -branch 'brtype(my_branch)' -exec 'echo $CLEARCASE_XPN'
%CLEARCASE_XPN%
是Windows语法。
%CLEARCASE_XPN%
is a windows syntax.
$ CLEARCASE_XPN
是unix语法,您可以在Linux tcsh会话中使用。
$CLEARCASE_XPN
is the unix syntax, that you can use in your Linux tcsh session.
请参见 cleartool find
和 cleartool find命令的其他示例 UNIX语法的示例。
See "cleartool find
" and "Additional examples of the cleartool find command" for many examples using the unix syntax.
还要注意在exec指令周围使用简单的引号: -exec'echo $ CLEARCASE_XPN '
。
这将防止外壳程序本身立即解释 $ CLEARCASE_XPN
变量(这对于tcsh会话是未知的),并将允许cleartool查找将正确的 value 传递给exec指令,将 $ CLEARCASE_XPN
替换为扩展名路径名。
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.
请参见 字符串引用(单引号)与弱引用(双引号):
强引号可以防止字符具有特殊含义,因此,如果将字符放在单引号中,则会看到得到的结果。
因此,如果不确定是否字符是否是特殊字符,请使用强引号。
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.
这篇关于CLEARCASE_XPN在clearcase命令中未解析为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!