-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
Description
In bash, a single-quoted string cannot contain a single quote even if it is escaped. However, single quotes can be included in a string of the form $'string' if they are escaped. I have an executable, hsp, that expects a single-quoted string. The following command works fine at the bash prompt and produces the expected output foo:
$ echo $'foo\nbar' | hsp $'\'o\' `elem` p'
foo
However the following test fails:
hsp $'\'o\' `elem` p'
<<<
foo
bar
>>>
foo
>>>= 0
Using debug I get the following:
command was: "hsp $'\\'o\\' `elem` p'"
stdout was : ""
stderr was : "/bin/sh: 1: Syntax error: Unterminated quoted string\n"
exit was : "2"
It looks like shelltestrunner is double escaping the single-quote, thereby creating a syntax error, when it should leave unchanged the single escape of the single-quote inside the form $'string".