1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Shell: Add support for special parameter that returns PID

This commit is contained in:
MinusGix 2019-09-09 16:48:04 -05:00 committed by Andreas Kling
parent 91a609d945
commit 8920ece8f6

View file

@ -309,6 +309,8 @@ static Vector<String> expand_parameters(const StringView& param)
String variable_name = String(param.substring_view(1, param.length() - 1));
if (variable_name == "?")
return { String::number(g.last_return_code) };
else if (variable_name == "$")
return { String::number(getpid()) };
char* env_value = getenv(variable_name.characters());
if (env_value == nullptr)