ln -sf source_file target_file
succeeds even when source_file does not exist.
ln -f source_file target_file
on the other hand fail, as expected.
How can it be tuned to give error on the first case without first testing for the file existence explicitly (i.e. not [[ -e source_file ]] && ln -sf source_file target_file
)
-s
alone with a non-existent source creates a broken symlink silently.ln -f
without-s
must of course fail because you're asking it to increase the ref count on a non-existent inode. – Joseph R. Jul 12 '13 at 21:51