Closed FOSSilizedDaemon closed 3 weeks ago
The shell complains about non-existing variables if the nounset option is on. It seems to be turned on here in your case.
If you want the shell to silently ignore such variables, you can remove the set command.
Another workaround is (as you already mentioned) to use ${DIRENV_DIR:-""}
, or simply ${DIRENV_DIR-}
.
Describe the bug I am currently implementing
direnv
support into my configuration. I started by adding thedirenv
shell script offered in the example rc file.I then wiped up a quick prompt to show either
direnv
orpython
status.However, every time I run a shell I get the following line
yash: parameter DIRENV_DIR' is not set
after every command and when I am not in adirenv
allowed directory. I did some digging and it is coming from my prompt function_update_direnv_status
. From my understanding within POSIX and many other shells, though I may be wrong, this shouldn't be happening because if "${DIRENV_DIR}" is empty the shell will simply move on. Am I missing something? To Reproduce Steps to reproduce the behavior:Expected behavior I expect the shell to show nothing related to direnv when not in a direnv allowed directory.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context I do not have any additional context other than my current dotfiles located here.
As an update, I found a workaround. If you set
you won't get the message. I have not experienced this in other shells, maybe it is a POSIX thing? At any rate, functionally solved. My bad! Though, I have noticied this in scripts and even elsewhere in my configuration. If I have a script that can take optional arguments, or a function or alias that can, such as
and I run it as 'ga' it should then run
git add . --verbose
as"${1}"
is empty, but instead I getyash: parameter
1' is not set` and it skips to the else statement.