如何检查是否已从命令行登录perforce

时间:2016-02-09 06:56:12

标签: perforce

我希望命令检查我是否已登录perforce,如果我已登录则返回0,否则返回一些非零值来表示错误。如何从命令行实现这一目标?

1 个答案:

答案 0 :(得分:8)

p4 help login说:

p4 login [-a -p] [-h <host>] [user]
p4 login [-s]

[...]

The -s flag displays the status of the current ticket (if there is one).

此外,经验测试显示,登录时运行p4 login -s会返回退出代码0,并且在未登录时运行它会返回退出代码1。