Skip to content

Instantly share code, notes, and snippets.

@yokawasa
Created January 9, 2019 01:11
Show Gist options
  • Save yokawasa/d093fd698014b1e2653acc8a8bc57c69 to your computer and use it in GitHub Desktop.
Save yokawasa/d093fd698014b1e2653acc8a8bc57c69 to your computer and use it in GitHub Desktop.

According to this,

More precisely, a double dash (--) is used in bash built-in commands and many other commands to signify the end of command options, after which only positional parameters are accepted.

For example

# with -- you can grep for string -v like this
# normally -v will be considered the option to reverse the matching meaning
$ grep -- -v file

# -- signify the end of command options of kubectl, and kubectl simply
# execute bash (a command after --) in pod named  nginx-8b8bd48f9-dr44s
kubectl exec -it nginx-8b8bd48f9-dr44s -- bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment