Running a command in another cli

I am writing a script to login to to a mongo DB node and get the status of that machine. The usual work flow is :

[root@mongodb-secondary-1 ~]# mongo admin -u root -p root 
MongoDB shell version: 3.0.11
connecting to: admin
rs0:SECONDARY> 

Then in the new prompt I can run a command to check status :

rs0:SECONDARY> rs.status()
{
	"set" : "rs0",
	"date" : ISODate("2017-04-04T19:24:56.369Z"),
	"myState" : 2,
	"syncingTo" : "172.29.219.108:27017",
	"members" : [
		{
			"_id" : 0,
			"name" : "172.29.219.108:27017",
.
.
.

Now since I am loging into from another node, I want this all in one shot. Something like :

mongo admin -u root -p root ; rs.status()

But unfortunately this does not work. Any idea how I can send a command to another application CLI and get the status ?

---------- Post updated at 12:31 AM ---------- Previous update was at 12:26 AM ----------

Got the solution :

mongo admin -u root -p root --quiet --eval 'printjson(rs.status())'