I have a symbolic name java or jre or jre1.5 or jre1.6 or java1.5 or java1.6 that point to the corresponding directory. Given the first instance, it will look like this:
java -> /usr/java/jdk1.5.x.x
My goal is this:
- To check if a character exists or not
- To get the value of a directory indicating
- Use regular expression instead of using if-else statement in code.
The link will be in / usr / tmp.
I wrote code in Perl that looks like this:
$filename = "/usr/local/java";
if (-l $filename) {
print "File exists \n";
} else {
print "Not \n";
}
But in case java is missing and java1.4 or java1.5 is present instead, I want to do a search that should start with java and is a symbolic link.
I also need to get the directory that it points to. Please advice on how to proceed.