Add home directory support to dotfiles.sh get

This commit is contained in:
Riyyi
2018-01-02 18:58:40 +01:00
parent 8a5bcc521e
commit f09fb07c1f
2 changed files with 12 additions and 2 deletions
+1
View File
@@ -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
+11 -2
View File
@@ -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/<user>/
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