feat(expansion): remove double quotes

This commit is contained in:
william.valenduc 2026-01-28 21:26:51 +00:00
parent 28b2e82078
commit 75d417eecf

View file

@ -135,7 +135,7 @@ bool expand(struct ast_command *command, const struct hash_map *vars)
{ {
if (str[i] == '\'') if (str[i] == '\'')
{ {
// remove quote // remove single quote
in_quotes = !in_quotes; in_quotes = !in_quotes;
memmove(str + i, str + i + 1, strlen(str + i + 1) + 1); memmove(str + i, str + i + 1, strlen(str + i + 1) + 1);
i--; i--;
@ -144,6 +144,12 @@ bool expand(struct ast_command *command, const struct hash_map *vars)
{ {
continue; // do nothing continue; // do nothing
} }
else if (str[i] == '\"')
{
// remove double quote
memmove(str + i, str + i + 1, strlen(str + i + 1) + 1);
i--;
}
else if (str[i] == '$' && str[i + 1] != 0 && !isspace(str[i + 1])) else if (str[i] == '$' && str[i + 1] != 0 && !isspace(str[i + 1]))
{ {
// variable expansion // variable expansion