开发者

ClearCase: Is it a bug or a feature?

开发者 https://www.devze.com 2023-04-09 11:28 出处:网络
When I run the following code intereactively from bash it works fine. cleartool setview $myview cleartool lsbl

When I run the following code intereactively from bash it works fine.

cleartool setview $myview
cleartool lsbl

But when I put them in a script and try to run the script, it never returns from the first cleartool command.

It seems in the interactive case the first cleartool command opens a new bash to run in and when you run the second command from the new shell it works fine. But in case of the script the new shell is not being visible and hence it seems not to return from the command.

Is there anyway to keep the cleartool commands in the same 开发者_如何学JAVAbash shell they are running from?


The cleartool setview command opens a new interactive shell. In that shell you execute the second command when you type it by hand. When you put both lines into a script, the setview executes the shell waiting for your input. The second command is executed as soon as you exit that shell. Of course the second command is not executed in the context of $myview.

To make things a little bit clearer do the following: In a shell execute cleartool setview $myview five times. Type echo $$ after each setview. This gives you the process ID of the current shell. The numbers will increase. Then type exit in each shell. Do echo $$ again after each exit. The old number will appear in decreasing order. After six exits you terminal should be closed.

That was the explanation. A solution for your problem might be the -exec option of the setview command:

cleartool setview $myview -exec "cleartool lsbl"

should do the trick.


While it doesn't directly answer the question, the following might do what you want. It makes the second command run in the subshell that the first command opens.

cleartool setview $myview << EOF
cleartool lsbl
EOF
0

精彩评论

暂无评论...
验证码 换一张
取 消