From fc3a25324c990eec7132ea68691c1e1f6882f704 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 25 Apr 2016 20:33:02 +0300 Subject: adjust_dotfiles_permissions: also directories --- .bashrc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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/'"'" -- cgit v1.2.3