Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check if already logged in perforce from command line

Tags:

perforce

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?

like image 617
rahul.deshmukhpatil Avatar asked Feb 09 '16 06:02

rahul.deshmukhpatil


1 Answers

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.

like image 80
jamesdlin Avatar answered Nov 13 '22 20:11

jamesdlin