Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah, OK. This works because you're using single quotes on your strings, meaning the escape sequence `[ is preserved until it reaches the globbing layer. This will not work, for example...

  gi "`[abc`]"
...because the `[ will be processed before the string gets sent to globbing, meaning the back tick will be removed. This would work with double quotes:

  gi "``[abc``]"
...because at the command line level this will evaluate to `[abc`] and the globbing will know that the square brackets are literal. So I will concede and downgrade my complaint from "impossible" to merely "overly complicated for the layman".


Anyone used to scripting languages knows there's a difference between single quotes and double quotes for escaping.


> Anyone used to scripting languages knows there's a difference between single quotes and double quotes for escaping.

Not necessarily. There are all sorts of scripting languages where single and double quotes are identical.

It is, however, super common for there to be escaping differences in shell scripting languages.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: