#!/bin/bash # some basic sanity / verification # assumes we have trash-put in path # I don't recommend actually running this unless you have a reason to, # since it creates & deletes files, and being a test, it is not as thoroughly # inspected for bugs err() { echo error } # target linkname case1() { touch b lnf a b [[ -L b ]] || err } # target directory case2() { mkdir b lnf a b [[ -L b/a ]] || err } # target case3() { mkdir a touch a/b lnf ../a [[ -L a ]] || err } # target target directory case4() { mkdir a touch a/b touch a/c lnf b c d a [[ -L a/b && -L a/c && -L a/d ]] || err } cleanup() { rm -rf * } docases() { case1 cleanup case2 cleanup case3 cleanup case4 cleanup } source ${0%/*}/../lnf-function # might want to undo this if things go wrong # set -x set -eE; trap 'echo "${BASH_COMMAND:+BASH_COMMAND=\"$BASH_COMMAND\" } ${FUNCNAME:+FUNCNAME=\"$FUNCNAME\" }${LINENO:+LINENO=\"$LINENO\" }\$?=$?"' ERR cd $(mktemp -d) docases trash-put() { rm -rf "$@" } docases echo success