basic: fix env expansion for strings leading with two dollar signs

The way to escape a literal dollar sign is to write "$$". But this does
not work right if it's at the beginning of the argument. Fix it.
This commit is contained in:
Michal Schmidt
2015-10-07 14:43:55 +02:00
parent 42911a567d
commit df553b586b
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -541,7 +541,7 @@ char **replace_env_argv(char **argv, char **env) {
STRV_FOREACH(i, argv) {
/* If $FOO appears as single word, replace it by the split up variable */
if ((*i)[0] == '$' && (*i)[1] != '{') {
if ((*i)[0] == '$' && (*i)[1] != '{' && (*i)[1] != '$') {
char *e;
char **w, **m = NULL;
unsigned q;