Files ending in -function are for sourcing then calling as a function. Files
without -function are exactly the same except they are for calling as a script.
-Patches and bugs are very welcome via gitlab.
-
-Questions, feedback, etc are very welcome via email to Ian Kelling
-<ian@iankelling.org>. I will add any useful questions, answers, etc. to this
-file. If a mailing list / forum is ever called for, I will start one.
+Patches, bugs, and any feedback is very welcome via gitorious or email to
+Ian Kelling <ian@iankelling.org>.
This program is also part of a collection of programs,
-https://gitlab.com/iankelling/bash-programs-by-ian, which are unrelated except
+https://gitorious.org/bash-programs-by-ian, which are unrelated except
having the same author and being being bash programs.
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
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"
[[ -e "${1##*/}" || -L "${1##*/}" ]] && $remove "${1##*/}"
fi
- $reset_extglob && shopt -u extglob
+ $reset_extglob && shopt -u extglob
ln -s $nodir -- "$@"
}
lnf "$@"
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
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"
[[ -e "${1##*/}" || -L "${1##*/}" ]] && $remove "${1##*/}"
fi
- $reset_extglob && shopt -u extglob
+ $reset_extglob && shopt -u extglob
ln -s $nodir -- "$@"
}
case1() {
touch b
lnf -T a b
- [[ -L b ]]
+ [[ -L b ]]
}
# 2 arguments, test that directory in link location is removed and replaced with a link
case2() {
mkdir b
lnf -T a b
- [[ -L b ]]
+ [[ -L b ]]
}
# single argument, test that an existing non-empty directory is removed and replaced by a link
mkdir a
touch a/b
lnf ../a
- [[ -L a ]]
+ [[ -L a ]]
}
# 4 arguments, 2 of the link locations already contain files.
touch a/b
touch a/c
lnf b c d a
- [[ -L a/b && -L a/c && -L a/d ]]
+ [[ -L a/b && -L a/c && -L a/d ]]
}
# 2 arguments, test that link is made correctly
case5() {
mkdir b
lnf a b
- [[ -L b/a ]]
+ [[ -L b/a ]]
}