1

When first installing powerlevel10k, one usually follows the guides available on the Internet and clone the repository inside oh-my-zsh's folder:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Now, if I echo $ZSH_CUSTOM I will get /home/myuser/.oh-my-zsh/custom as expected, but printenv will not list it at all. Why is that?

manoelpqueiroz
  • 135
  • 1
  • 5
  • 1
    Does this answer your question? [Is \`env\` not to print out the environment in the current shell, but the environment received within \`env\`?](https://unix.stackexchange.com/questions/293302/is-env-not-to-print-out-the-environment-in-the-current-shell-but-the-environm) – muru May 10 '21 at 14:45

1 Answers1

2

The :- in the variable tells bash (or zsh) to use whatever is after the - as the default value. If ZSH_CUSTOM is not in your environment variables (it doesn't show up in printenv), it will default to $HOME/.oh-my-zsh/custom.

You can try it yourself:

echo ${MY_VARIABLE}
# prints an empty line
echo ${MY_VARIABLE:-a default value}
# prints: a default value
Gert
  • 9,886
  • 3
  • 36
  • 37