20 lines
313 B
Bash
Executable file
20 lines
313 B
Bash
Executable file
#!/bin/sh -e
|
|
|
|
test -d files/ || {
|
|
>&2 echo "Not in dotfiles root"
|
|
exit 1
|
|
}
|
|
|
|
for arg in $@; do
|
|
arg="$(realpath "$arg")"
|
|
file="${arg#"$HOME"}"
|
|
|
|
test "$arg" != "$file" || {
|
|
>&2 echo "$f is not in $HOME"
|
|
continue
|
|
}
|
|
|
|
cp -v "$arg" "${arg}.bak"
|
|
mv -iv "$arg" "files/$file"
|
|
ln -vfs "files/$file" "$arg"
|
|
done
|