On a unix machine, how can I write a shell script for checking if 'java bin' directory has been included in $PATH env. variable?
You beat me by seconds! :-)
Paul Tomblin
2010-06-23 14:16:40
@Paul I see 14:13:59Z for both
Michael Mrozek
2010-06-23 14:18:18
Yeah, but yours shows up ahead of mine, so you must have hit the database ahead of mine.
Paul Tomblin
2010-06-23 14:35:18
@Paul Ah, I guess checking the ID would be the logical way to find out :)
Michael Mrozek
2010-06-23 15:34:17
+1
A:
Since the directory name can be anything, this would be a bit hard to check by looking at the $PATH variable, but you could try looking at the return value of a command like which javac
.
Miel
2010-06-23 14:15:20
A:
which
is appropriate, but only checks for your command defined in $PATH. What if javac is not defined in $PATH but it is installed somewhere else? In that extreme case, you use find
or locate
to find where javac
is.
ghostdog74
2010-06-23 14:38:01