From a64bd7c8a6d0a091210f0d2ea905b07ef2a67a52 Mon Sep 17 00:00:00 2001 From: Phani Pavan K Date: Fri, 6 Feb 2026 13:09:17 +0530 Subject: [PATCH] add multi shell init, fixes #8 --- penv | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/penv b/penv index 08bbefa..550efcc 100755 --- a/penv +++ b/penv @@ -150,10 +150,17 @@ install() { . \$HOME/.envs/\$1/bin/activate } " > "$HOME"/.envs/.penv.funcs - grep -qxF "source \$HOME/.envs/.penv.funcs" "$HOME"/.bashrc || echo "source \$HOME/.envs/.penv.funcs" >> "$HOME"/.bashrc + add2RC bashrc + add2RC zshrc echo "Initialized PENV. Restart the shell" } +add2RC(){ + if [[ -f "$HOME/.$1" ]]; then + grep -qxF "source \$HOME/.envs/.penv.funcs" "$HOME/.$1" || echo "source \$HOME/.envs/.penv.funcs" >> "$HOME/.$1" + fi +} + uninstall() { if [[ -n "$VIRTUAL_ENV" ]]; then echo "Deactivate the existing environment before uninstalling" @@ -182,7 +189,7 @@ uninstall() { } pyls(){ - find /usr/local/bin /usr/bin -name python3.* 2> /dev/null | tr " " "\n" | grep "3.*" --color=always + find /usr/local/bin /usr/bin -name "python3.*" 2> /dev/null | tr " " "\n" | grep "3.*" --color=always } if [ "$#" -lt 1 ]; then