sh -c 'env HOME=$(mktemp -d) fish'
)?fish version installed (2.3.1):
OS/terminal used:
Ubuntu 16.04 server
Talk about the the issue here.
awk or gawk sub function not works properly. The results are different from awk in bash.
In fish, use following command, it gave nothing.
gawk 'BEGIN{a = "abc def"; b = gensub(/(.+) (.+)/, "\\2 \\1", "g", a); print b}'
In bash, the same command gave the right output def abc
The issue here is the "\" in quotes. Fish will still strip one of the two, while bash will leave it. See for yourself with e.g. echo gawk ...
.
Add one more - "\\\2 \\\1"
and it works.
I think that this is expected (there are other differences in quoting behavior, and often with good reason), but I'll have to consult our docs some more.
Also, what does this have to do with math
?
@faho Thank you! It works!
Sorry for the confusion of math
which comes from the issue template.
Most helpful comment
The issue here is the "\" in quotes. Fish will still strip one of the two, while bash will leave it. See for yourself with e.g.
echo gawk ...
.Add one more -
"\\\2 \\\1"
and it works.I think that this is expected (there are other differences in quoting behavior, and often with good reason), but I'll have to consult our docs some more.