Skip to content

Commit

Permalink
updated shell_link.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Jan 25, 2025
1 parent 784e3ab commit 3444e6a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions setup/shell_link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ if [ -n "${FORCE:-}" ]; then
opts="-f"
fi

HOME="${HOME:-$(cd && pwd)}"

for filename in $conf_files; do
if [[ "$filename" =~ / ]]; then
dirname="${filename%/*}"
dirname="${dirname#configs}"
dirname="${dirname##/}"
dirname="${dirname%%/}"
srcdir="${filename%/*}"
destdir="${srcdir#configs}"
destdir="${destdir##/}"
destdir="${destdir%%/}"
filename="${filename##*/}"
sourcepath="$PWD${dirname+/$dirname}/$filename" # if dirname, insert /dirname in middle
destpath=~${dirname+/"$dirname"/} # if dirname, append /dirname to dest
sourcepath="$PWD${srcdir+/$srcdir}/$filename" # if dirname, insert /dirname in middle
destpath="$HOME${destdir+/"$destdir"/}" # if dirname, append /dirname to dest
sourcepath="${sourcepath/\/\//\/}"
destpath="${destpath/\/\//\/}"
mkdir -pv "$destpath"
Expand Down

0 comments on commit 3444e6a

Please sign in to comment.