
{"id":16076,"date":"2014-11-24T13:39:25","date_gmt":"2014-11-24T13:39:25","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=16076"},"modified":"2014-11-24T13:39:25","modified_gmt":"2014-11-24T13:39:25","slug":"hacking-with-the-quote-command-on-bash-shell","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/11\/24\/hacking-with-the-quote-command-on-bash-shell\/","title":{"rendered":"Hacking with the quote command on Bash shell"},"content":{"rendered":"<p><u>ABOUT Quoting<\/u><\/p>\n<pre>\nQuoting is used to remove the special meaning of certain characters or words to the shell.  Quoting can\nbe used to disable special treatment for special characters, to prevent reserved words from being\nrecognized as such, and to prevent parameter expansion.\n\nEach of the shell metacharacters (*note Definitions::) has special meaning to the shell and must be\nquoted if it is to represent itself. When the command history expansion facilities are being used \n(*note History Interaction::), the HISTORY EXPANSION character, usually '!', must be quoted to prevent\nhistory expansion.  *Note Bash History Facilities::, for more details concerning history expansion.\n\nThere are three quoting mechanisms: the ESCAPE CHARACTER, single quotes, and double quotes.\n\n<u>Escape Character<\/u>\n\nA non-quoted backslash '\\' is the Bash escape character.  It preserves the literal value of the next\ncharacter that follows, with the exception of 'newline'.  If a '\\newline' pair appears, and the backslash\nitself is not quoted, the '\\newline' is treated as a line continuation (that is, it is removed from the\ninput stream and effectively ignored).\n\n\n<u>Single Quotes<\/u>\n\nEnclosing characters in single quotes (''') preserves the literal value of each character within the\nquotes.  A single quote may not occur between single quotes, even when preceded by a backslash.\n\n<u>Double Quotes<\/u>\n\n\nEnclosing characters in double quotes ('\"') preserves the literal value of all characters within the\nquotes, with the exception of '$', '`', '\\', and, when history expansion is enabled, '!'.  \nThe characters '$' and '`' retain their special meaning within double quotes (*note Shell\nExpansions::).  The backslash retains its special meaning only when followed by one of the following\ncharacters: '$', '`', '\"', '\\', or 'newline'.  Within double quotes, backslashes that are followed by\none of these characters are removed.  Backslashes preceding characters without a special meaning are left\nunmodified.  A double quote may be quoted within double quotes by preceding it with a backslash.  If\nenabled, history expansion will be performed unless an '!' appearing in double quotes is escaped using a\nbackslash.  The backslash preceding the '!' is not removed.\n\nThe special parameters '*' and '@' have special meaning when in double quotes (*note Shell Parameter\nExpansion::).\n\n<\/pre>\n<p><u>TYPICAL SHELL SESSION RELATED<\/u><br \/>\n[bash]<br \/>\n$echo quote ls<br \/>\nquote ls<br \/>\n$echo &#8216;quote ls&#8217;<br \/>\nquote ls<br \/>\n$echo &#8216;quote ls`<br \/>\n&gt; ;<br \/>\n&gt; ^C<br \/>\n$echo `quote ls`<br \/>\n&#8216;ls&#8217;<br \/>\n$echo `ls`<br \/>\nanimal.png animal.xcf icon.png<br \/>\n$ls<br \/>\nanimal.png  animal.xcf  icon.png<br \/>\n$ls `quote ls`<br \/>\nls: cannot access &#8216;ls&#8217;: No such file or directory<br \/>\n$ls &#8216;quote `ls`&#8217;<br \/>\nls: cannot access quote `ls`: No such file or directory<br \/>\n$echo  &#8216;quote `ls`&#8217;<br \/>\nquote `ls`<br \/>\n$echo  `quote `ls&#8220;<br \/>\n&#8221;ls<br \/>\n$echo  &quot;quote `ls`&quot;<br \/>\nquote animal.png<br \/>\nanimal.xcf<br \/>\nicon.png<br \/>\n$echo  &#8216;quote `ls`&#8217;<br \/>\nquote `ls`<br \/>\n$echo  &#8216;ls  `ls`&#8217;<br \/>\nls  `ls`<br \/>\n$quote &quot;ls pwd&quot;<br \/>\n&#8216;ls pwd&#8217;$<br \/>\n$quote &quot;ls pwd \\n&quot;<br \/>\n&#8216;ls pwd \\n&#8217;$<br \/>\n$ls `quote ls`<br \/>\nls: cannot access &#8216;ls&#8217;: No such file or directory<br \/>\n$ls `ls`<br \/>\nanimal.png  animal.xcf  icon.png<br \/>\n$<\/p>\n<p>[\/bash]<br \/>\nLINK<br \/>\n<a href=\"https:\/\/www.gnu.org\/software\/bash\/manual\/bash.txt\">https:\/\/www.gnu.org\/software\/bash\/manual\/bash.txt<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ABOUT Quoting Quoting is used to remove the special meaning of certain characters or words to the shell. Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion. Each of the shell metacharacters (*note Definitions::) has special meaning to the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2014\/11\/24\/hacking-with-the-quote-command-on-bash-shell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hacking with the quote command on Bash shell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[457,1335,1437],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16076"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=16076"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16076\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=16076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=16076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=16076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}