The issue is I have to touch a particular file in a ClearCase view after touching it, I have to exit the view.
And now I must reset the same view again.
Now when I reset, it will open in different mode.
I have tried this so far in shell script. When executing this script I am in view XYZ
#!/bin/sh
touch /ccase/.host;
exit;
ct setview XYZ
cd /ccase/src
The problem I am facing is in line 3 (exit;
).
I am coming out of script and not from view.
I would rather try without using cleartool setview
.
Access your data directly in the full path of your view: /view/XYZ/vobs/yourVob
That way:
- you don't have to exit any process in your script.
- you avoid creating a sub-shell when you call
setview
in your script: that explain why your path is incorrect.
See "Python and ClearCase setview" for an example of the kind of issue that sub-shell causes.
That obviously assume your dynamic view is already started (if not, cleartool startview
).
For a better understanding of why your shell cannot be completely executed when using setview
, see "Setting into a view from a shell script does not process the remaining commands in the script"
In the above script, any commands that appear after the execution of cleartool setview XYZ
are not processed because a shell is spawned with exec()
, which replaces the current program with a new program.
This means current process text and code segments, which in this case is the script that contains all the commands, is replaced by the program getting executed, which is the shell invoked by running cleartool setview XYZ
.
Hence, none of the commands are processed beyond the point of invocation of the setview.
In your case, the cd /ccase/src is never called.
If you work directly with the full path of your started view, you don't create any sub-shell and don't have that issue: your last cd /ccase/src
will be called.
1- Use:
cleartool startview <your_view_tag>
instead of
cleartool setview <your_view_tag>
Then you will be able to access your view simply using:
cd /view/<your_view_tag>/<your_vob_name>
touch <yourfile>
and eventually do the same thing with another view and using the same or an other vob.
This method will not open an other shell and you will get rid of any exit
command in your script