Bash Double Hyphen
We often see commands posted online that use a double-hyphen (–). Many shell commands (the ones using getopt to fetch command-line options) support the use of this double-hyphen to stop further processing of command-line flags. This is useful when we want to specify a literal hyphen, and to prevent accidental injection of command line options.
For example, try this:
touch -f
In the above example, touch assumes that “-f” is a command line flag. Now, let’s try it again with a double-hyphen
touch -- -f
When you see the directory listing, you will observe a new file that is literally named “-f”
Similarly, try rm -f
which will have no effect on the existence of the file, but rm -- -f
will delete the file.