ClearCase:这是一个错误还是一个功能?

发布于 2024-12-07 14:51:59 字数 311 浏览 0 评论 0原文

当我从 bash 交互运行以下代码时,它工作正常。

cleartool setview $myview
cleartool lsbl

但是当我将它们放入脚本并尝试运行该脚本时,它永远不会从第一个cleartool命令返回。

在交互式情况下,第一个cleartool命令似乎打开了一个新的bash来运行,当您从新的shell运行第二个命令时,它工作正常。但在脚本的情况下,新的 shell 不可见,因此它似乎不会从命令返回。

有没有办法将cleartool命令保留在它们运行的​​同一个bash shell中?

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 bash shell they are running from?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉梦枕江山 2024-12-14 14:52:00

cleartool setview 命令打开一个新的交互式 shell。在该 shell 中,当您手动键入第二个命令时,您将执行该命令。当您将这两行放入脚本中时,setview 会执行 shell 等待您的输入。一旦退出该 shell,就会执行第二个命令。当然,第二个命令不是在 $myview 上下文中执行的。

为了使事情更清晰,请执行以下操作:在 shell 中执行 cleartool setview $myview 五次。在每个 setview 之后输入 echo $$。这将为您提供当前 shell 的进程 ID。数字将会增加。然后在每个 shell 中输入 exit。每次退出后再次echo $$。旧号码将以降序显示。六次退出后,您的终端应该关闭。

这就是解释。您的问题的解决方案可能是 setview 命令的 -exec 选项:

cleartool setview $myview -exec "cleartool lsbl"

应该可以解决问题。

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.

翻身的咸鱼 2024-12-14 14:52:00

虽然它没有直接回答问题,但以下内容可能会满足您的要求。它使第二个命令在第一个命令打开的子 shell 中运行。

cleartool setview $myview << EOF
cleartool lsbl
EOF

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文