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

"--" isn't anything special in a typical shell. It's just another argument, one that customarily means "pass the rest of arguments on to a subprocess". Or are you confused about the "#"? It doesn't start a comment in the middle of a token.


> one that customarily means "pass the rest of arguments on to a subprocess".

It's convenient for passing options and args to a subprocess, but it customarily means "don't interpret anything following this as a short or long option, just as a positional argument". For example:

  touch -f     # error
  touch -- -f  # creates a file named "-f"
  rm *         # oh crap we just passed "rm -f" a bunch of files
  rm -- *      # don't treat that "-f" as an option, just delete the file named "-f"


It was the "#". I didn't realize that about the behavior in the middle of a token, and apparently the syntax colorizer doesn't either.




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

Search: