diff --git a/doc/management.txt b/doc/management.txt index c8ba0e379..dd886dec7 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1249,8 +1249,8 @@ example : # echo "show info;show stat;show table" | socat /var/run/haproxy stdio -If a command needs to use a semi-colon (eg: in a value), it must be preceeded -by a backslash ('\'). +If a command needs to use a semi-colon or a backslash (eg: in a value), it +must be preceeded by a backslash ('\'). The interactive mode displays a prompt ('>') and waits for commands to be entered on the line, then processes them, and displays the prompt again to wait diff --git a/src/cli.c b/src/cli.c index 239a505ad..a1923bc4e 100644 --- a/src/cli.c +++ b/src/cli.c @@ -434,13 +434,17 @@ static int cli_parse_request(struct appctx *appctx, char *line) while (++arg <= MAX_STATS_ARGS) args[arg] = line; - /* remove \ */ + /* unescape '\' */ arg = 0; while (*args[arg] != '\0') { j = 0; for (i=0; args[arg][i] != '\0'; i++) { - if (args[arg][i] == '\\') - continue; + if (args[arg][i] == '\\') { + if (args[arg][i+1] == '\\') + i++; + else + continue; + } args[arg][j] = args[arg][i]; j++; }