1

My Script is storing a ClearCase View in a Variable. To operate in this View, the Script needs to call itself inside the View again, after it started the View. The Code looks like this

 if($params{ViewSet} eq 'no')
    {
       # Start the View
       # Store the View in $View
       # Call the Script in the new-set View with parameter -ViewSet yes
    }
if($params{ViewSet} eq 'yes')
    {
      # Do Work inside the View
    }

The problem is, obviously the Variable $View is not defined when I call my script the second time, since it is defined in the first if loop.

Can I pass the View I stored in $View when I call the Script the second time? Setting the View before entering the if-Statements would not word, I would start the View two times then.

yoko
  • 516
  • 1
  • 3
  • 18
  • 1
    Why are you doing this? Stating the actual problem you are trying to solve would help here. –  Nov 26 '15 at 07:02
  • 1
    @dan1111 This is a ClearCase specific problem that I know well. I have answered it below. – VonC Nov 26 '15 at 07:43

1 Answers1

0

Call the Script in the new-set View with parameter -ViewSet

If that involve calling cleartool setview, don't: setview spawns a subshell in which what you have defined in your script won't be visible.

When your script needs to access the dynamic view started, do use the full dynamic view path:

/view/myDynView
# under which you would see:
/view/myDynView/vobs/MyVob
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I know about the subshell problem, I wanted to know it there would be any Option for a workaround. I have found a working solution for myself, but thanks for your hint ;) The Solution was first to get the Viewname from the View I am using, and store all information about the new view in a new variable. That way, I didn't actually pass the Variable from one view(shell) into another, but created the exact same one in the new View. Worked for my problem. – yoko Nov 26 '15 at 07:46