Add simple stow automatic linking script
This commit is contained in:
parent
d34cecb27e
commit
34779454be
1 changed files with 30 additions and 0 deletions
30
stow.sh
Executable file
30
stow.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Stow automatic symlinking script
|
||||||
|
#
|
||||||
|
# Invokes stow for every folder within this repository, and that's it.
|
||||||
|
|
||||||
|
# to_stow=$(ls -l --time-style="long-iso" . | grep -E '^d' | awk '{print $8}')
|
||||||
|
|
||||||
|
stow_dirs() {
|
||||||
|
for d in */; do
|
||||||
|
printf "stowing %s\n" "$d"
|
||||||
|
stow "$d"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
have_stow() {
|
||||||
|
type stow >/dev/null 2>&1 || printf "GNU stow needs to be installed for this script to function. Please install stow through your package manager.\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ "$1" != "" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-s | --stow)
|
||||||
|
have_stow
|
||||||
|
stow_dirs
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
Loading…
Reference in a new issue