I have a program like this:
ssh -q [email protected] exit
echo "output value -->$?"
In the above code, I am trying to SSH to the remote server, and tries to check if I can connect or not. I have few servers, which is password less is activated and few servers for which passwords are still not yet deactivated. So my concern, if there is a password, it will get stuck in the same screen asking for the password and it will be there for infinite time, without Exit logic.
Question : How to implement the timers for the above code, and if it stays in the same screen asking for the password. and exit with some error code
2) When I execute the above code, i get the following error codes:
127 -- > I guess its for success
225 -- > for any error.
are there any other error codes other than above?
man sysexitsto see the recommended exit codes for programs. I don't know if they differ in other operating system. Generally, an exit value of0means "success", and anything else is some kind of failure.