gpt4 book ai didi

unix - 如何一次性运行多个 Unix 命令

转载 作者:行者123 更新时间:2023-12-02 13:51:32 24 4
gpt4 key购买 nike

我试图一次执行多个命令,但令我惊讶的是,只有第一个命令被执行,其余的被跳过。命令是

cleartool setview view1234 ; cleartool setactivity activity456 ; cd /vobs/app/src/epw/WEB-INF/scripts ; pwd

上面命令的输出是
You can now run 'clearquest' to start Rational ClearQuest.

但相反,我希望看到以下 3 行输出:
You can now run 'clearquest' to start Rational ClearQuest.
Set activity "activity456" in view "view1234".
/vobs/app/src/epw/WEB-INF/scripts

我的搜索工作通过将分号 (;) 替换为与号 (&) 或管道 (|) 来为同一命令产生更多变体,但似乎没有任何效果。

关于如何运行上述多个命令的任何建议/想法?

最佳答案

不要在子shell中使用 cleartool setview : it forks the current shell ,这就是为什么在单行中执行时会跳过其余部分的原因。
这就是为什么它在一个一个执行时起作用(最后两个在子shell中执行)
始终使用 full path of the dynamic view : /view/aview/vobs/avob/... ,而不是 setview (您不需要)。
如果您必须使用 cleartool setview ,则将其与 -exec 选项 ( as in this answer ) 一起使用:

cleartool setview -login -exec "command 1; command 2; command 3" view_tag
在你的情况下:
cleartool setview -exec 'cleartool setactivity activity456 ; cd /vobs/app/src/epw/WEB-INF/scripts ; pwd' view1234 

没有设置 View :
OP问:

Say my view named humanbeing is in universe/planet/earth/humanbeing.vws

How do I use the startview command?
Is it something like

cleartool startview universe/planet/earth/humanbeing

or

cleartool startview cd universe/planet/earth/humanbeing

In both the cases it says the Error: Couldn't set view tag universe/planet/earth/humanbeing


可以肯定的是,做一个 cleartool lsview -s | grep humanbeing :这会给你 View 标签。
那应该是:
cleartool startview humanbeing
cd /view/humanbeing/vobs/<avob>
universe/planet/earth/humanbeing.vws 是 View 存储,而不是 View 标签。
确保
  • 已安装 (cleartool mount /vobs/avob)
  • myapp/WEB-INF/scripts 存在于 /view/humanbeing/vobs/<avob>

  • 不要尝试在 /vobs 中进行任何符号链接(symbolic link): /vobs 是一个特殊的 MVFS(多版本文件系统)挂载点,而不是常规文件夹。
    确保您的 webapp 在 /vobs 之外的其他路径中搜索应用程序。

    关于unix - 如何一次性运行多个 Unix 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31865630/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com