diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index f301cffc1b..ea5b04cf80 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -1028,7 +1028,11 @@ int Shell::builtin_unset(int argc, const char** argv) if (!parser.parse(argc, const_cast(argv), Core::ArgsParser::FailureBehavior::PrintUsage)) return 1; + bool did_touch_path = false; for (auto& value : vars) { + if (!did_touch_path && value == "PATH"sv) + did_touch_path = true; + if (lookup_local_variable(value)) { unset_local_variable(value); } else { @@ -1036,6 +1040,9 @@ int Shell::builtin_unset(int argc, const char** argv) } } + if (did_touch_path) + cache_path(); + return 0; }