nash icon indicating copy to clipboard operation
nash copied to clipboard

scanner/parser: add support for single quote strings

Open i4ki opened this issue 9 years ago • 4 comments

λ> echo 'hello world'
hello world
λ> echo "hello world"
hello world

Single quoted string must behave in the same way as double quoted string.

i4ki avatar Oct 03 '16 17:10 i4ki

Make sense, nowadays this command will fail with single quote

[«08:39:24 ~»]λ> chmod '+x' c /bin/chmod: invalid mode: ‘'+x'’ Try '/bin/chmod --help' for more information. ERROR: exit status 1

lborguetti avatar Mar 03 '17 11:03 lborguetti

I don't like it. I don't see any advantage on having two different ways to do the same thing. This only opens space to code that has " sometimes and ' on other times, and people arguing about how the code should be consistent, and them people documenting that in project X you should always use ", or ', for consistency sake.

katcipis avatar Mar 03 '17 11:03 katcipis

But we need to solve exactly the problem @lborguetti is pointing out.

@katcipis What do you think of failing with a good error message in case of using single quotes?

$ chmod '+x' a.sh
error: Use double quotes instead of single.

# single quotes inside double works as expected
$ echo "'"
'

i4ki avatar Mar 04 '17 12:03 i4ki

@tiago4orion Error message sounds good

katcipis avatar Mar 04 '17 12:03 katcipis