Search code examples
shellclearcase

Script exits after view is set (clearcase)


I am trying to run a shell script. Inside the script, I need to set the view:

ct setview viewname

then run some commands. What happens is that after the view is set, the script exits. I also tried the following as suggested in other posts:

cleartool setview -exec script viewname
cleartool: Error: View tag not found: ", -exec, "

I also tried the full path for cleartool. Didn't work!

Can anyone help, please?


Solution

  • As I mentioned before in "Python and ClearCase setview", using setview in a script is generally not a good idea.
    It will create a subshell, which will cause any running script to exit once that subshell exits.

    If you can, use the full dynamic view path (/view/myView/vobs/myVob/...): you are then sure in that path to run as many scripts/commands as you want.
    As long as the dynamic view is started and the vob mounted, you don't need setview.

    If you do need setview:

    • cleartool setview -exec script viewname: make sure you type yourself the '-' in -exec, and don't copy-paste it. That is because of the hyphen-minus bug I illustrate in ClearCase question.
    • try do set the view, then run your script (two steps, as I recommend here)