#!/usr/bin/env nix-shell #!nix-shell -i bash -p bash set -e lnfrom="$1" lnto="$2" # ln is clever when there's something else at the place we want to create the link # only create the link if nothing's there or what is there is another link, # otherwise you'll get links at unexpected fs locations ! test -e "$lnfrom" || test -L "$lnfrom" && ln -sf --no-dereference "$lnto" "$lnfrom"