summaryrefslogtreecommitdiffstats
path: root/src/parse
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-17 00:05:00 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-17 00:05:00 -0500
commite7d8a9f7d234cb2b8a6691c5a2e33f2b18776a3d (patch)
tree84eac0ddc63e529275f48071adfdfefd1cdc1c0a /src/parse
parenta537464a915aea2e38c62df041996b8525367bde (diff)
downloadnbsh-e7d8a9f7d234cb2b8a6691c5a2e33f2b18776a3d.tar.gz
nbsh-e7d8a9f7d234cb2b8a6691c5a2e33f2b18776a3d.zip
simplify environment handling
this temporarily breaks cd history, will fix this soon
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/ast.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs
index 88ae734..bac40c8 100644
--- a/src/parse/ast.rs
+++ b/src/parse/ast.rs
@@ -330,7 +330,9 @@ impl WordPart {
fn eval(self, env: &Env) -> String {
match self {
Self::Alternation(_) => unreachable!(),
- Self::Var(name) => env.var(&name),
+ Self::Var(name) => {
+ env.var(&name).unwrap_or_else(|| "".to_string())
+ }
Self::Bareword(s)
| Self::DoubleQuoted(s)
| Self::SingleQuoted(s) => s,