{"id":1420,"date":"2017-03-21T15:01:15","date_gmt":"2017-03-21T09:31:15","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=1420"},"modified":"2018-10-24T14:15:38","modified_gmt":"2018-10-24T08:45:38","slug":"double-dash-mean-also-known-bare-double-dash","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/double-dash-mean-also-known-bare-double-dash\/","title":{"rendered":"What does \u201c&#8211;\u201d (double-dash) mean? (also known as \u201cbare double dash\u201d)"},"content":{"rendered":"<h2 id=\"double-dash\"><span style=\"color: #003300;\">Double dash:<\/span><\/h2>\n<ul>\n<li>The double dash &#8220;&#8211;&#8221; means end of command line flags i.e. it tells the preceding command not to try to parse what comes after command line options.<\/li>\n<li>It is actually part of the POSIX standard that &#8212; can be used to separate options from other <a href=\"https:\/\/www.wikitechy.com\/technology\/how-to-pass-arguments-to-a-bash-script-using-linux\/\" target=\"_blank\" rel=\"noopener\">arguments<\/a>, so you will see it on <a href=\"https:\/\/www.wikitechy.com\/technology\/27-handy-chrome-os-commands-run-crosh\/\" target=\"_blank\" rel=\"noopener\">commands<\/a> like cp and mv (which are not part of Bash).<\/li>\n<li>&#8212; works to separate options from regular expressions in grep, but the canonical way is to use -e\/&#8211;regexp<\/li>\n<\/ul>\n<h3 id=\"example-use\"><span style=\"color: #ff6600;\"><strong>Example use:<\/strong><\/span><\/h3>\n<p>you want to grep a file for the string -v &#8211; normally -v would be considered as the option to reverse the matching meaning (only show lines that do not match), but with &#8212; you can grep for string -v like this:<\/p>\n[pastacode lang=&#8221;bash&#8221; manual=&#8221;grep%20&#8211;%20-v%20file%20&#8243; message=&#8221;Bash Code&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]\n<p>A\u00a0double dash\u00a0(\u00a0&#8212;\u00a0) is used in <a href=\"https:\/\/www.wikitechy.com\/tutorials\/linux\/how-to-test-if-a-variable-is-a-number-in-bash\" target=\"_blank\" rel=\"noopener\">bash<\/a> built-in commands and there are more other commands to signify the end of command options, after which only positional parameters are accepted<\/p>\n<h3 id=\"example\"><span style=\"color: #808000;\"><strong>Example:<\/strong><\/span><\/h3>\n<p>Suppose you have a file named path\/to\/file.txt in my Git repository, and you want to revert changes on it.<\/p>\n[pastacode lang=&#8221;bash&#8221; manual=&#8221;git%20checkout%20path%2Fto%2Ffile.txt%0A&#8221; message=&#8221;Bash Code&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]\n<p style=\"top: 214px;\">[ad type=&#8221;banner&#8221;]\n<p>Now suppose that the file is named master&#8230;<\/p>\n[pastacode lang=&#8221;bash&#8221; manual=&#8221;git%20checkout%20master%0A&#8221; message=&#8221;Bash Code&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]\n<p>Whoops! That changed branches instead.\u00a0The &#8212; helps to separate the <a href=\"https:\/\/www.wikitechy.com\/technology\/c-algorithm-check-given-graph-tree-not\/\" target=\"_blank\" rel=\"noopener\">tree<\/a> you want to check out from the files you want to check out.<\/p>\n[pastacode lang=&#8221;bash&#8221; manual=&#8221;git%20checkout%20&#8211;%20master%0A%0A&#8221; message=&#8221;Bash Code&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]\n<h4 id=\"it-also-helps-us-if-some-freako-added-a-file-named-f-to-our-repository\"><span style=\"color: #ff6600;\"><b style=\"color: #ff6600;\">It also helps us if some <\/b><span style=\"color: #ff6600;\"><b>freako<\/b><\/span><b style=\"color: #ff6600;\">\u00a0added a file named -f to our repository:<\/b><\/span><\/h4>\n[pastacode lang=&#8221;bash&#8221; manual=&#8221;git%20checkout%20-f%20%20%20%20%20%20%23%20wrong%0Agit%20checkout%20&#8211;%20-f%20%20%20%23%20right%0A&#8221; message=&#8221;Bash Code&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]\n[ad type=&#8221;banner&#8221;]\n","protected":false},"excerpt":{"rendered":"<p>Double dash: The double dash &#8220;&#8211;&#8221; means end of command line flags i.e. it tells the preceding command not to try to parse what comes after command line options. It is actually part of the POSIX standard that &#8212; can be used to separate options from other arguments, so you will see it on commands [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1331],"tags":[2765,2761,2755,2764,2756,2762,2758,2751,2763,2759,2752,2760,2753,2757,2754],"class_list":["post-1420","post","type-post","status-publish","format-standard","hentry","category-linux","category-unix","tag-bash-escape-double-dash","tag-bash-getopts-double-dash","tag-changing-extension-to-multiple-files","tag-double-hyphen-meaning","tag-how-to-less-a-file-named","tag-javascript-double-dash","tag-linux-dash-commands","tag-related-queries-what-is-dash-actually-in-unix-or-linux","tag-unix-command-line-options-convention","tag-unix-dash-commands","tag-what-does-mean-with-association-to-linux-files-and-directories","tag-what-does-the-double-dash-mean-in-writing","tag-why-do-many-cli-apps-take-a-single-argument","tag-why-do-we-use-double-dash-in-git-checkout","tag-why-is-printf-better-than-echo"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=1420"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1420\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=1420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=1420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=1420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}