mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
nixos/zsh: don’t be noisy when scripts are run with -u
When a script specifies the shell option “nounset” as part of the shebang (e.g., via “#!/usr/bin/env -S zsh -u”), our initialization scripts would produce error messages of the form: __ETC_FOO_SOURCED: parameter not set These messages could probably be confusing to users when running such scripts. By providing a fall-back in the parameter expansion, we can avoid them. This patch does not address interactive shell start-up, where such messages may (or may not) be less problematic.
This commit is contained in:
parent
bc4ce318bf
commit
7d84dbdf5b
1 changed files with 3 additions and 3 deletions
|
@ -173,10 +173,10 @@ in
|
|||
# This file is read for all shells.
|
||||
|
||||
# Only execute this file once per shell.
|
||||
if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
|
||||
if [ -n "''${__ETC_ZSHENV_SOURCED-}" ]; then return; fi
|
||||
__ETC_ZSHENV_SOURCED=1
|
||||
|
||||
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
|
||||
if [ -z "''${__NIXOS_SET_ENVIRONMENT_DONE-}" ]; then
|
||||
. ${config.system.build.setEnvironment}
|
||||
fi
|
||||
|
||||
|
@ -206,7 +206,7 @@ in
|
|||
${zshStartupNotes}
|
||||
|
||||
# Only execute this file once per shell.
|
||||
if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi
|
||||
if [ -n "''${__ETC_ZPROFILE_SOURCED-}" ]; then return; fi
|
||||
__ETC_ZPROFILE_SOURCED=1
|
||||
|
||||
# Setup custom login shell init stuff.
|
||||
|
|
Loading…
Reference in a new issue