rewrote script for broken symlinks in dash/posix shell