From 52cab309a7838dd4597abeb6fbff91e6218be3fb Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 5 Jun 2018 10:47:47 +0300
Subject: [PATCH] Interactive sudo usage will pass shell function definitions.

---
 .bashrc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.bashrc b/.bashrc
index 5297793..994066e 100644
--- a/.bashrc
+++ b/.bashrc
@@ -86,7 +86,7 @@ alias gen-mac="hexdump -n5 -e '\"02\" 5/1 \":%02X\" \"\\n\"' /dev/urandom"
 alias clean-swp="find \$HOME/ -name '*.swp' -delete"
 alias unssh="ssh -o \"UserKnownHostsFile /dev/null\" -o \"StrictHostKeyChecking no\""
 alias todo="vim \$HOME/Documents/TODO.yml"
-alias sudo="sudo "
+[ -n "${SHELL:-}" ] && alias sudo="sudo -E $SHELL -c" || alias sudo="sudo "
 alias git="git "
 alias xargs="xargs "
 alias presentation='docker dev adarnimrod/presentation'
@@ -270,6 +270,7 @@ then
         [ ! -f "$sourcefile" ] || . "$sourcefile"
     done
     ! command -v direnv > /dev/null || eval "$(direnv hook bash)"
+    eval "$(declare -F | sed 's/declare/export/g')"
 fi
 
 
-- 
GitLab