You know, if the potential port name can be expressed by a basic regular expression, re_format, you can write:ls -d /usr/ports/*/*nvidia*Do you still need a directory full of symbolic links?
You do not appear to use any bashisms, your script does not consider that things may go wrong (⇒ at least...