我试图一次性执行多个命令,但令我惊讶的是,只有第一个命令被执行,其余命令被跳过。命令是
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
没有 setview:
OP 询问:
Say my view named
humanbeing
is inuniverse/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(多版本文件系统)安装点,而不是常规文件夹。
确保您的网络应用程序在 /vobs
之外的其他路径中搜索应用程序。
关于unix - 如何一次性运行多个 Unix 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31865630/