I am writing a Shell Script where user will pass the path to JAVA_HOME as a parameter. I wanted to check whether the JAVA_HOME path is valid or not. So how can I check whether the input path passed is a exe file ( Unix Executable File ) or not ? Suppose if users passed /usr/bin/java - which is valid, if user passes like /usr/bin/test.txt ( some text file )- which is not valid. So how can I check whether the file is of type Unix Executable File ?
I tried with -x , guess that is not the rite check , since it returns true for /usr/bin also !!!