mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
Shell: Add support for special parameter that returns PID
This commit is contained in:
parent
91a609d945
commit
8920ece8f6
1 changed files with 2 additions and 0 deletions
|
@ -309,6 +309,8 @@ static Vector<String> expand_parameters(const StringView& param)
|
||||||
String variable_name = String(param.substring_view(1, param.length() - 1));
|
String variable_name = String(param.substring_view(1, param.length() - 1));
|
||||||
if (variable_name == "?")
|
if (variable_name == "?")
|
||||||
return { String::number(g.last_return_code) };
|
return { String::number(g.last_return_code) };
|
||||||
|
else if (variable_name == "$")
|
||||||
|
return { String::number(getpid()) };
|
||||||
|
|
||||||
char* env_value = getenv(variable_name.characters());
|
char* env_value = getenv(variable_name.characters());
|
||||||
if (env_value == nullptr)
|
if (env_value == nullptr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue