2

I installed Kali Linux v2020.4 using i3-wm and have updated .profile [below] to include an exported PATH, as I assumed updating .profile would impact all shells (sh, Bash, Zsh, etc.).

After logging out/in, I'm not able to run a script that exists inside Desktop, but if I run source ~/.profile, then I'm able to execute it:

export PATH="$HOME/Desktop:$PATH"

# if running bash
if [ -n "$BASH_VERSION" ]; then
  # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
      . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
  PATH="$HOME/.local/bin:$PATH"
fi
  • This is strange behavior to me and has only occurred using Kali; I have no ~/bash_profile, and don't want to include it in ~/.bashrc, as I want it to be available for all shells
5
  • Does the issue affect all shells? or just Bash? Commented Jan 11, 2021 at 18:25
  • The issue affects all shells Commented Jan 12, 2021 at 10:50
  • Do all shells use ~/.profile by default (for example, I don't believe Zsh does)? What shells are being used besides Bash? You may also want to check out the .profile man page via man .profile, or some variant thereof, and have you tried adding it to /etc/profile instead of ~/.profile?
    – JW0914
    Commented Feb 2, 2021 at 13:08
  • @JW0914 I changed my default shell back to bash, using chsh, and the problem persists. Also I edited /etc/profile to include export PATH="$HOME/Desktop:$PATH" and still nothing in PATH. Commented Feb 2, 2021 at 17:00
  • That sounds like it's specific to Kali's set up, so the best place to look for an answer will likely be Kali's man page for profile (I could also very be wrong, as I'm more familiar with Zsh than Bash and other shells)
    – JW0914
    Commented Feb 3, 2021 at 13:02

0

You must log in to answer this question.

Browse other questions tagged .