ClearCase find and exec with %CLEARCASE_PN% in cmd

2019-07-29 15:18发布

问题:

I executed the following command in cleartool.exe:

    cleartool> !
    Microsoft Windows XP [Version 5.1.2600]
    ...
    X:\dyn_view\vob\path>cleartool find . -type l -exec "cleartool describe
%CLEARCASE_PN%" -print

But the element output is always the same regarding exec, albeit being different in print. How to output the correct list in the exec part of the command?

Example output:

symbolic link ".\path\fileA.txt" -> ../../path/fileA.txt
  created ...
.\anypath\fileB.txt
symbolic link ".\path\fileA.txt" -> ../../path/fileA.txt
  created ...
.\anypath\fileC.txt

Where fileA is always the same (part of exec parameter), only fileB, fileC, etc., change (part of print parameter).

回答1:

Following the example listed in "Additional examples of the cleartool find command"

X:\dyn_view\vob\path>
cleartool find . -type l -exec "cleartool describe \"%CLEARCASE_PN%\""

So:

  • no -print at the end
  • '\"' around %CLEARCASE_PN% to take into account spaces in the path

Note that you can combine that with fmt_ccase for a refined display:

cleartool find . -type l -exec "cleartool describe -fmt \"%n %[slink_text]Tp\n\" \"%CLEARCASE_PN%\""

Example:

Y:\VOB_A>
cleartool find . -type l -exec "cleartool describe -fmt "%n%[slink_text]Tp\n\n\" \"%CLEARCASE_PN%\""
.\Directory\createsymlink.txt -->..\..\VOB_B\SymlinkFolder\createsymlink.txt

With:

%[slink_text]Tp

representing "Target of symbolic link, after link is traversed."