Skip to content

Commit 6ae1d89

Browse files
committed
builtins: use a warning for declare -p with undefined variables
Instead of raising an error. The exit status of the command should be enough to signify failure. This avoids the issue where `declare -p UNDEFINED_VAR` is being used to determine if a variable is defined causing errors when sourcing the related file or string.
1 parent 1b10d1a commit 6ae1d89

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builtins/declare.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ declare_internal (WORD_LIST *list, int local_var)
398398
pflag = show_name_attributes (list->word->word, nodefs);
399399
if (pflag)
400400
{
401-
sh_notfound (list->word->word);
401+
builtin_warning (_("%s: not found"), list->word->word);
402402
any_failed++;
403403
}
404404
}

0 commit comments

Comments
 (0)