Code Sample |
for eachdir in `ls -d /opt/java* 2>/dev/null`; do for TEMP in `find "$eachdir" 2>/dev/null | grep -re "/bin/java$" `; do if [ -x "$TEMP" ]; then JAVAEXEC="$TEMP" break 2; fi done done |
Quote (^thehatsrule^ @ Oct. 18 2006,18:33) | ||
This is just my opinion: using find in / is not a good idea, since that will go through every possible directory (including attached media). At the very least, start in /opt (and/or /usr). Also, what if there is more than one instance of /bin/java ? Then there'd be multiple entries. I'd suggest something like...
Also, why would you need to check if it is a symlink instead? |