X-Git-Url: https://iankelling.org/git/?p=lnf;a=blobdiff_plain;f=lnf;fp=lnf;h=c907b6246416e27a6bbb0d5b9fa6cf9d7922c61b;hp=29f137df5f89acaa63075826a3801c2cf5333569;hb=fae0c9143e694a3ed895cee68d1adad9bc359f05;hpb=056e6160cd38fa3bf1622ed4f4c0179f84b53c2f diff --git a/lnf b/lnf index 29f137d..c907b62 100755 --- a/lnf +++ b/lnf @@ -15,7 +15,7 @@ Create directory if needed. Slightly more restrictive arguments than ln. In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd form, create links to each TARGET in DIRECTORY." - + if [[ $1 == --help || $# -eq 0 ]]; then echo "$help" return 0 @@ -30,19 +30,19 @@ links to each TARGET in DIRECTORY." return 1 fi fi - + local reset_extglob=false ! shopt extglob >/dev/null && reset_extglob=true shopt -s extglob - + local remove x if type -P trash-put >/dev/null; then remove=trash-put else remove="rm -rf" fi - + if [[ $nodir ]]; then if [[ -e "$2" || -L "$2" ]]; then $remove "$2" @@ -72,7 +72,7 @@ links to each TARGET in DIRECTORY." [[ -e "${1##*/}" || -L "${1##*/}" ]] && $remove "${1##*/}" fi - $reset_extglob && shopt -u extglob + $reset_extglob && shopt -u extglob ln -s $nodir -- "$@" } lnf "$@"