I want command to check if I am already logged in perforce, which returns 0 if I am logged in, otherwise some non-zero value to represent error. how to achieve this from command line?
p4 help login
says:
p4 login [-a -p] [-h <host>] [user]
p4 login [-s]
[...]
The -s flag displays the status of the current ticket (if there is one).
Additionally, empirical testing shows that running p4 login -s
while logged in returns an exit code of 0, and running it while not logged in returns an exit code of 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With