.
This commit is contained in:
parent
dc7daed18b
commit
9b119fb54b
4 changed files with 41 additions and 2 deletions
20
add.sh
Executable file
20
add.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue