From f09fb07c1fc758c5643cb535a060af0c38eb4082 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 2 Jan 2018 18:58:40 +0100 Subject: [PATCH] Add home directory support to dotfiles.sh get --- .config/i3/config | 1 + dotfiles.sh | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 8920386..d2b8733 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -131,6 +131,7 @@ bindsym $mod+Shift+0 move container to workspace 10 assign [class="Firefox"] $workspace1 assign [class="Chromium"] $workspace1 +assign [class="Gedit"] $workspace2 assign [class="URxvt"] $workspace3 assign [class="Thunar"] $workspace4 diff --git a/dotfiles.sh b/dotfiles.sh index 37b7968..5d29ef2 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -40,8 +40,17 @@ elif [ "$1" == "list" ]; then elif [ "$1" == "get" ] && [ "$2" != "" ]; then FILE=$(readlink -f $2) - mkdir -p $(pwd)/$(dirname $FILE) - cp $FILE $(pwd)/$FILE + FILE_CUT_HOME="$(echo $FILE | sed -nr 's/^\/home\/'$USER'\/(.*)$/\1/p')" + + # /home// + if [ -n "$FILE_CUT_HOME" ]; then + mkdir -p $(pwd)/$(dirname $FILE_CUT_HOME) + cp $FILE $(pwd)/$FILE_CUT_HOME + # / + else + mkdir -p $(pwd)/$(dirname $FILE) + cp $FILE $(pwd)/$FILE + fi elif [ "$1" == "pull" ] || [ "$1" == "push" ]; then for f in $FILES; do