From 46c1a319051ec87fe3cb8f14000e62e050abdab3 Mon Sep 17 00:00:00 2001 From: Squibid Date: Sat, 10 Aug 2024 02:40:04 -0400 Subject: add root cp --- README.md | 4 ++++ auto. | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index db46e25..7f881b7 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ $$ echo "a shell command" # copying files filea -> fileb +# the copy command may also be prefixed with a # like so: +filea #-> fileb +# which will copy the file as root + # installing programs :: neovim,firefox,neofetch ``` diff --git a/auto. b/auto. index d86f855..e258cf5 100755 --- a/auto. +++ b/auto. @@ -165,13 +165,18 @@ while read -r line || return 0; do # remove/add a file elif printf "%s" "$line" | grep -q -- "->"; then # get the path of the file - sourcef=$(eval echo "${line%%\ ->*}") + sourcef=$(eval echo "${line%% *->*}") # get the destination for the file - destf=$(eval echo "${line##*->\ }") + destf=$(eval echo "${line##*->* }") # install/uninstall - [ $install ] && cp -rv -- "$sourcef" "$destf" - [ $uninstall ] && rm -rv -- "$destf" + if printf "%s" "$line" | grep -q -- "#->"; then + [ $install ] && dort cp -rv -- "$sourcef" "$destf" + [ $uninstall ] && dort rm -rv -- "$destf" + else + [ $install ] && cp -rv -- "$sourcef" "$destf" + [ $uninstall ] && rm -rv -- "$destf" + fi fi done < "$topography" -- cgit v1.2.1