aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-04-25 20:33:02 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-04-25 20:33:02 +0300
commitfc3a25324c990eec7132ea68691c1e1f6882f704 (patch)
treeb6c626039b3d3c80c691937521d1028d88799d7d
parentadjust_dotfiles_permissions: recursively (diff)
downloadlinux-home-fc3a25324c990eec7132ea68691c1e1f6882f704.tar.gz
linux-home-fc3a25324c990eec7132ea68691c1e1f6882f704.zip
adjust_dotfiles_permissions: also directories
-rw-r--r--.bashrc14
1 files changed, 13 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index 0e84ad9..7a640a2 100644
--- a/.bashrc
+++ b/.bashrc
@@ -207,8 +207,20 @@ nwx_dev=172.28.12.149
nwx_dev2=172.28.19.60
nwx_dev3=172.28.19.61
+adjust_dotdirs_permissions() {
+ pushd ~ > /dev/null || return $?
+ {
+ git ls-files | xargs realpath | xargs dirname
+ realpath .
+ } | sort | uniq | grep --fixed-strings --invert-match --line-regex "$( realpath . )" | xargs chmod 0700
+ popd > /dev/null
+}
+
adjust_dotfiles_permissions() {
- pushd ~ && git ls-tree -r HEAD | cut -f 2 | xargs chmod 0600 && popd
+ pushd ~ > /dev/null || return $?
+ adjust_dotdirs_permissions
+ git ls-tree -r HEAD | cut -f 2 | xargs chmod 0600
+ popd > /dev/null
}
alias trim_trailing_whitespace='sed --binary --in-place '"'"'s/[[:blank:]]*\(\r\?\)$/\1/'"'"