Update AUTOYADMDIR to account for any location of the scripts

This commit is contained in:
Daniel Fichtinger 2024-11-10 03:56:54 -05:00
parent caf575e3ad
commit 7656a53bdf
2 changed files with 11 additions and 6 deletions

View file

@ -4,7 +4,9 @@
# arguments and appends them to the "tracked"
# file, for use by autoyadm.sh
YADMDIR="$HOME/.config/yadm"
# We get the absolute path to the script's parent directory.
AUTOYADMDIR="script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
AYE="AutoYADM Error:"
AYM="AutoYADM:"
@ -28,8 +30,8 @@ for arg in "$@"; do
# convert to path relative to ~
rel=${abs#"$HOME/"}
# append to tracked file
echo "$HOME/$rel" >>"$YADMDIR/tracked"
echo "$AYM Tracking $HOME/$rel"
echo "$rel" >>"$AUTOYADMDIR/tracked"
echo "$AYM Tracking $HOME/$rel as '$rel'"
else
echo "$AYM Path must be inside the home directory."
exit 1