forked from Bananymous/banan-os
Shell: Expand ~ to home if its at the start of non quoted argument
This commit is contained in:
parent
4b13055125
commit
4f3c05851c
|
@ -254,6 +254,12 @@ static PipedCommand parse_piped_command(BAN::StringView command_view)
|
||||||
MUST(result.commands.push_back(current_command));
|
MUST(result.commands.push_back(current_command));
|
||||||
current_command.arguments.clear();
|
current_command.arguments.clear();
|
||||||
}
|
}
|
||||||
|
else if (c == '~' && (i == 0 || isspace(command_view[i - 1])))
|
||||||
|
{
|
||||||
|
const char* home_env = getenv("HOME");
|
||||||
|
if (home_env)
|
||||||
|
MUST(current_argument.append(home_env));
|
||||||
|
}
|
||||||
else if (!isspace(c))
|
else if (!isspace(c))
|
||||||
MUST(current_argument.push_back(c));
|
MUST(current_argument.push_back(c));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue