Speed up the link command.

 - Don't store intermediate variables; use pipes.
 - Use process substitution to speed up loops.
 - Minor clean-up & fix a few shellcheck warnings.

1 test re: Fail on newline in filename does *NOT* pass.
Is this behavior we need to keep?