Search code examples
linuxunixtclclearcase

Use Clearfsimport within a tcl exec command


I am using clearfsimport to recursively check a file tree into clearcase. From everything ive read it seems to be the best way however when I run the command exec clearfsimport -rec -nset create_clearcase_tempfile/* . inside of a tcl script I receive the following error;

Validating directory ".".
Closing directories.
No change in version "/main/91" of directory "."
clearfsimport: Error: Could not access "create_clearcase_tempfile/*".

My suspicion is that the /* confuses the command but when I try it outside of tcl directly in the bash commands it works exactly as expected. Can someone please tell me what im missing?


Solution

  • The issue is that (unlike bash) Tcl does not expand file globs by default; it just passes the * on over, and ClearCase gets surprised by that. You probably want to change:

    exec clearfsimport -rec -nset create_clearcase_tempfile/* .
    

    to this:

    exec clearfsimport -rec -nset {*}[glob create_clearcase_tempfile/*] .