Search code examples
clearcase

How to remove an element named '-c' from ClearCase


On creating some directories in ClearCase, I 'forgot' that the argument order was significant. I Added some directories like this:

cleartool mkdir a b -c "Some comment"

On being asked for a comment for the directories, I realised the '-c' arguemnt was in the wrong place, but assumed all would be OK, so entered Some comment twice more (for a, and b seperately). I was then asked for a comment for element '-c', and Ctrl-C'ed the command.

However, now cleartool ls shows elements a, b, and '-c'.

I cannot remove the '-c' element. I've tried the following:

cleartool rmelem "-c"   #fails, assumes the -c is the comment argument
cleartool rmelem -c "comment" -c
cleartool rmelem -c "comment" "-c"
cleartool rmelem -c "comment" ^-c    #Running on Windows, so tried Windows escape
cleartool rmelem -c "comment" \-c    #CC mimics UNIX, so tried UNIX escape
cleartool rmelem -c "comment" ^\-c   #CC mimics UNIX, but running thru Windows, so tried escaping the UNIX escape.

All fail, saying either Illegal duplicate use of flag "-c[omment]" (when not escaped), or Unable to access ... (when escaped).

One other strange thing. If I tried single quotes, ct assumed the ' was part of the element name:

> cleartool rmelem -c "Removing element '-c'" '-c'
cleartool: Error: Pathname not found: "'-c'".

Solution

  • Use a -- a separator between options and arguments.

    See Removing ClearCase objects whose name begins with a hyphen

    To remove a ClearCase object (view, VOB, element or other ClearCase objects) with a preceding hyphen (-) character, execute the cleartool command with a double-hyphen argument to prevent cleartool from interpreting the name as an option.

    cleartool rmelem -- -t1.txt