{"id":20316,"date":"2023-09-07T08:21:49","date_gmt":"2023-09-07T08:21:49","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=20316"},"modified":"2024-01-22T11:57:41","modified_gmt":"2024-01-22T11:57:41","slug":"what-is-quoting","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/","title":{"rendered":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]"},"content":{"rendered":"<p style=\"text-align: justify;\"><strong>Quoting <\/strong>is a fundamental and practical concept in Bash that controls variable expansion, and word splitting, and highly maintains the integrity of text data. By mastering the quoting mechanism, you can ensure better and more secure Bash scripts even in complex scenarios. In this article, you will explore <strong>what quoting is<\/strong> and what are the essential hacks of quoting in Bash.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#Key_Takeaways\" >Key Takeaways<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#What_is_Quoting\" >What is Quoting?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#What_Quoting_Serves\" >What Quoting Serves?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#5_Quoting_Hacks_in_Bash\" >5 Quoting Hacks in Bash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#Importance_of_Quoting_in_Bash\" >Importance of Quoting in Bash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#People_Also_Ask\" >People Also Ask<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Key_Takeaways\"><\/span>Key Takeaways<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>Learning about the definition of quoting.<\/li>\n<li>Understanding why quoting is important.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"What_is_Quoting\"><\/span>What is Quoting?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>Quoting <\/strong>is nothing but a critical process in Bash for ensuring code correctness that helps you understand which parts of your Bash code are meant to be treated as literal strings and which parts involve variable or command substitution. Quotes can also aid in removing the special meaning of special characters, preventing reserved words\u2019 recognition, disabling parameter expansion and so on.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Quoting_Serves\"><\/span>What Quoting Serves?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Following are several crucial purposes that Quoting serves in Bash:<\/p>\n<ul>\n<li style=\"text-align: justify;\"><strong>Employing Escape Sequences<\/strong>: Quoting is essential for handling <strong>special <\/strong><strong style=\"font-size: inherit; text-align: justify;\">characters<\/strong><span style=\"font-size: inherit; text-align: justify;\"> within strings or text. And you can use the <\/span><strong style=\"font-size: inherit; text-align: justify;\">escape sequences<\/strong><span style=\"font-size: inherit; text-align: justify;\"> to include special characters within the quoted strings. For example, you can use a <\/span><strong style=\"font-size: inherit; text-align: justify;\">backslash (\\)<\/strong><span style=\"font-size: inherit; text-align: justify;\"> before the <\/span><strong style=\"font-size: inherit; text-align: justify;\">double quotes (&#8220;)<\/strong><span style=\"font-size: inherit; text-align: justify;\"> to escape them and include them as part of the string.<\/span><\/li>\n<li style=\"text-align: justify;\"><strong>Representing Control Characters<\/strong>: You can perform quoting to represent <strong>control <\/strong><strong style=\"font-size: inherit;\">characters<\/strong><span style=\"font-size: inherit;\"> like <\/span><strong style=\"font-size: inherit;\">\\t (tab character) <\/strong><span style=\"font-size: inherit;\">or\u00a0 <\/span><strong style=\"font-size: inherit;\">\\n (newline character for line break)<\/strong><span style=\"font-size: inherit;\">.<\/span><\/li>\n<li style=\"text-align: justify;\"><strong>Parsing Code<\/strong>: Quoting plays a pivotal role in matching the delimiters correctly and parsing different parts of code.<\/li>\n<li style=\"text-align: justify;\"><strong>Including Dynamic Content<\/strong>: Through a quoting mechanism, you can perform <strong style=\"font-size: inherit;\">string interpolation<\/strong><span style=\"font-size: inherit;\"> or <\/span><strong style=\"font-size: inherit;\">concatenation <\/strong><span style=\"font-size: inherit;\">to include any dynamic content or variables within the quoted strings.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"5_Quoting_Hacks_in_Bash\"><\/span>5 Quoting Hacks in Bash<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In the following section, you will find some <strong>quoting hacks<\/strong> that will help you to work more efficiently:<\/p>\n<p style=\"text-align: justify;\"><strong>1. Quoting User Input<\/strong>: Whenever you are going to put the input into a command, never forget to quote the user input. Otherwise, there may be command injection bugs or security vulnerabilities.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">input=&quot;; rm -rf \/&quot;\u00a0<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">echo &quot;Here is $input&quot;<\/code><\/pre>\n<p style=\"text-align: justify;\"><strong>2. Quoting Filenames<\/strong>: When you are working with filenames, consider different quotes for different purposes like using one type of quote as a delimiter and another type of quote for messages, spaces, or internal quotes.<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">file=&#039;my file.txt&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\" data-line=\"\">echo &quot;Processing &#039;$file&#039;&quot;<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<ul>\n<li><strong>file=&#8217;my file.txt&#8217;<\/strong>: The single quotes are used as the delimiter here.<\/li>\n<li><strong>echo &#8220;Processing &#8216;$file'&#8221;<\/strong>: The <a href=\"https:\/\/linuxsimply.com\/echo-command-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>echo command<\/strong><\/a> prints the message inside the double quotes.<\/li>\n<\/ul>\n<\/div><\/div>\n<p style=\"text-align: justify;\"><strong>3. Quoting Entire Commands<\/strong>: Encase the entire command in <strong>double quotes<\/strong> if you want to use one command as an argument of another command. For example:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">output=&quot;$(grep &quot;pattern&quot; &quot;file.txt&quot;)&quot;<\/code><\/pre>\n<p style=\"text-align: justify;\"><strong>4. Quoting Multi-line Text<\/strong>: While working with multi-line text or data, use the <strong>HereDoc <\/strong>formula.<\/p>\n<p><strong style=\"color: #800080;\">Basic Syntax &gt;<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">Command &lt;&lt; Delimiter\nMulti-line\ntext block\nDelimiter<\/code><\/pre>\n<p style=\"text-align: justify;\"><strong>5. Disabling Quoting<\/strong>: Use a <strong>backslash (\\) <\/strong>before the <strong>dollar ($) <\/strong>symbol, whenever you need to <strong style=\"font-size: inherit;\">disable variable expansion<\/strong><span style=\"font-size: inherit;\"> temporarily encased in <\/span><strong style=\"font-size: inherit;\">double quotes<\/strong><span style=\"font-size: inherit;\">.<\/span><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">echo &quot;Hello, LinuxSimply \\$variable&quot;\u00a0<\/code><\/pre>\n<p><span style=\"color: #800080;\"><strong>Output &gt;<\/strong><\/span><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">Hello, LinuxSimply $variable<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Importance_of_Quoting_in_Bash\"><\/span>Importance of Quoting in Bash<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Go through the points below to get a clear view of the importance of quoting in Bash:<\/p>\n<ul>\n<li style=\"text-align: justify;\"><strong>Prevent Word Splitting<\/strong>: Word splitting means breaking an <strong>argument <\/strong>or <strong style=\"font-size: inherit;\">command <\/strong>into separate words by spaces or other delimiters among them. Proper quoting actually prevents this unexpected behavior of Bash considering the entire text as a single string.<\/li>\n<\/ul>\n<p><strong style=\"color: #800080;\">Wrong Syntax &gt;<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">variable=LinuxSimply<\/code><\/pre>\n<p><strong style=\"color: #800080;\">Right Syntax &gt;<\/strong><\/p>\n<pre><code class=\"language-bash\" data-line=\"\">variable=\u201dLinuxSimply\u201d<\/code><\/pre>\n<ul>\n<li style=\"text-align: justify;\"><strong>Prevent Command Substitution<\/strong>: Quoting also helps in preventing unintended command substitution within strings to reduce the security risk.<\/li>\n<li style=\"text-align: justify;\"><strong>Control Variable Substitution<\/strong>: Quoting allows you to control whether variables should be expanded or not. <strong style=\"font-size: inherit;\">Single quotes (&#8216; &#8216;)<\/strong><span style=\"font-size: inherit;\"> prevent variable expansion, while <\/span><strong style=\"font-size: inherit;\">double quotes (\u201c \u201d)<\/strong><span style=\"font-size: inherit;\"> allow variable substitution. This is very helpful for generating content with dynamic strings.<\/span><\/li>\n<li style=\"text-align: justify;\"><strong>Preserve Special Characters<\/strong>: While dealing with special characters like symbols, spaces, tabs, newlines, etc., quotes can be a handy dealer. When you encase these characters within quotes, Bash doesn\u2019t interpret them and treats them as literal characters.<\/li>\n<li style=\"text-align: justify;\"><strong>Create Multi-line Strings<\/strong>: As quoting preserves the line-breaking formats, it can be a crucial feature for creating multi-line strings.<\/li>\n<\/ul>\n<pre><code class=\"language-bash\" data-line=\"\">line_break=&quot;This is a\nmulti-line\nstring.&quot;<\/code><\/pre>\n<ul>\n<li style=\"text-align: justify;\"><strong>Command Safety<\/strong>: Appropriate quoting ensures that the commands you execute never offer any unintended side effects and work as expected format.<\/li>\n<li style=\"text-align: justify;\"><strong>Enhance Readability<\/strong>: Consistent and proper quoting enhances the readability of your Bash scripts by making it clear which and how strings should be interpreted and processed.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The whole article summarizes that proper quoting makes your Bash scripts behave as intended even though for complicated schemes. So, you just need to grasp the quoting hints.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"People_Also_Ask\"><\/span>People Also Ask<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"su-accordion su-u-trim\">\n<p style=\"text-align: justify;\"><div class=\"su-spoiler su-spoiler-style-fancy su-spoiler-icon-plus\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span><strong>What do you mean by escape sequences, and when to use them?<\/strong><\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\"><strong>Escape sequences<\/strong> are the feature that represents characters with special meaning within a string. You can use them when you need to include any special characters without breaking the string. For example, <strong>\\&#8221;<\/strong> for a double quote within quotes or <strong>\\n<\/strong> for a newline.<\/div><\/div>\n<div class=\"su-spoiler su-spoiler-style-fancy su-spoiler-icon-plus su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span><strong>How to quote multi-line text in Bash?<\/strong><\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\">You can use the <strong>HeredDoc format<\/strong> to quote multi-line text in Bash.<\/div><\/div>\n<p style=\"text-align: justify;\"><div class=\"su-spoiler su-spoiler-style-fancy su-spoiler-icon-plus su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span><strong>Can wrong quoting cause security issues in Bash?<\/strong><\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\"><strong>Yes<\/strong>, if you perform wrong quoting, it will potentially lead your Bash scripts to harmful consequences or vulnerabilities.<\/div><\/div>\n<p style=\"text-align: justify;\"><div class=\"su-spoiler su-spoiler-style-fancy su-spoiler-icon-plus su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span><strong>How to employ double quotes in a variable in Bash?<\/strong><\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\">You have to encase a variable in single or double quotes to employ double quotes within it.<\/div><\/div>\n<\/div>\n<p><span style=\"font-size: 18pt; color: #003366;\"><strong>Related Articles<\/strong><\/span><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/single-quotes\/\" target=\"_blank\" rel=\"noopener\">Understanding Single Quotes in Bash [2 Examples With Cases]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/double-quotes\/\" target=\"_blank\" rel=\"noopener\">Understanding Double Quotes in Bash [3 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/single-vs-double-quotes\/\" target=\"_blank\" rel=\"noopener\">Bash Single Vs Double Quotes [3 Cases to Differentiate]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/escape-quotes\/\" target=\"_blank\" rel=\"noopener\">Escape Quotes in Bash<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<p><strong>&lt;&lt; Go Back to <span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Bash Quotes&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1065921,&quot;3&quot;:{&quot;1&quot;:0},&quot;9&quot;:1,&quot;10&quot;:1,&quot;11&quot;:4,&quot;12&quot;:0,&quot;17&quot;:1,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/\" target=\"_blank\" rel=\"noopener\">Bash Quotes<\/a><\/span> | <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/\" target=\"_blank\" rel=\"noopener\">Bash Scripting Tutorial<\/a><\/strong><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;20316&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;3&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;5\\\/5 - (3 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 142.5px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            5\/5 - (3 votes)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Quoting is a fundamental and practical concept in Bash that controls variable expansion, and word splitting, and highly maintains the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#more-20316\" aria-label=\"Read more about What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\">Read more<\/a><\/p>\n","protected":false},"author":314905,"featured_media":20317,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[129],"class_list":["post-20316","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash-scripting","tag-bash-quotes","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]<\/title>\n<meta name=\"description\" content=\"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\" \/>\n<meta property=\"og:description\" content=\"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/nadiba.rahman?mibextid=ZbWKwL\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-07T08:21:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:57:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nadiba Rahman\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nadiba Rahman\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/\"},\"author\":{\"name\":\"Nadiba Rahman\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/69b717a03a5d9dc48e683aaffe22d33f\"},\"headline\":\"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\",\"datePublished\":\"2023-09-07T08:21:49+00:00\",\"dateModified\":\"2024-01-22T11:57:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/\"},\"wordCount\":924,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Feature-image-What-is-quoting-1.png\",\"keywords\":[\"bash quotes\"],\"articleSection\":[\"Bash Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/\",\"name\":\"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Feature-image-What-is-quoting-1.png\",\"datePublished\":\"2023-09-07T08:21:49+00:00\",\"dateModified\":\"2024-01-22T11:57:41+00:00\",\"description\":\"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Feature-image-What-is-quoting-1.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Feature-image-What-is-quoting-1.png\",\"width\":400,\"height\":400,\"caption\":\"Feature image-What is quoting in Bash\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/what-is-quoting\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bash Scripting Tutorial\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bash Quotes\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/quotes\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"name\":\"LinuxSimply\",\"description\":\"All About Linux\",\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linuxsimply.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\",\"name\":\"LinuxSimply\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"width\":355,\"height\":48,\"caption\":\"LinuxSimply\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/69b717a03a5d9dc48e683aaffe22d33f\",\"name\":\"Nadiba Rahman\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Nadiba-Rahman-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Nadiba-Rahman-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Nadiba-Rahman-II-96x96.png\",\"caption\":\"Nadiba Rahman\"},\"description\":\"Hello, This is Nadiba Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation with a bachelor\u2019s degree in Electronics &amp; Telecommunication Engineering from Rajshahi University of Engineering &amp; Technology (RUET).I am quite passionate about crafting. I really adore exploring and learning new things which always helps me to think transparently. And this curiosity led me to pursue knowledge about Linux. My goal is to portray Linux-based practical problems and share them with you. Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/nadiba.rahman?mibextid=ZbWKwL\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/nadiba-rahman-443459171\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/nadiba\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]","description":"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/","og_locale":"en_US","og_type":"article","og_title":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]","og_description":"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.","og_url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/nadiba.rahman?mibextid=ZbWKwL","article_published_time":"2023-09-07T08:21:49+00:00","article_modified_time":"2024-01-22T11:57:41+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png","type":"image\/png"}],"author":"Nadiba Rahman","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nadiba Rahman","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/"},"author":{"name":"Nadiba Rahman","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/69b717a03a5d9dc48e683aaffe22d33f"},"headline":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]","datePublished":"2023-09-07T08:21:49+00:00","dateModified":"2024-01-22T11:57:41+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/"},"wordCount":924,"commentCount":0,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png","keywords":["bash quotes"],"articleSection":["Bash Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/","url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/","name":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png","datePublished":"2023-09-07T08:21:49+00:00","dateModified":"2024-01-22T11:57:41+00:00","description":"After knowing about what is quoting in Bash, try to apply it in a proper and effective way to get the most of it.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Feature-image-What-is-quoting-1.png","width":400,"height":400,"caption":"Feature image-What is quoting in Bash"},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/what-is-quoting\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxsimply.com\/"},{"@type":"ListItem","position":2,"name":"Bash Scripting Tutorial","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/"},{"@type":"ListItem","position":3,"name":"Bash Quotes","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/quotes\/"},{"@type":"ListItem","position":4,"name":"What is Quoting in Bash? [5 Hacks You Didn\u2019t Know]"}]},{"@type":"WebSite","@id":"https:\/\/linuxsimply.com\/#website","url":"https:\/\/linuxsimply.com\/","name":"LinuxSimply","description":"All About Linux","publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxsimply.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linuxsimply.com\/#organization","name":"LinuxSimply","url":"https:\/\/linuxsimply.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","width":355,"height":48,"caption":"LinuxSimply"},"image":{"@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/69b717a03a5d9dc48e683aaffe22d33f","name":"Nadiba Rahman","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Nadiba-Rahman-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Nadiba-Rahman-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Nadiba-Rahman-II-96x96.png","caption":"Nadiba Rahman"},"description":"Hello, This is Nadiba Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation with a bachelor\u2019s degree in Electronics &amp; Telecommunication Engineering from Rajshahi University of Engineering &amp; Technology (RUET).I am quite passionate about crafting. I really adore exploring and learning new things which always helps me to think transparently. And this curiosity led me to pursue knowledge about Linux. My goal is to portray Linux-based practical problems and share them with you. Read Full Bio","sameAs":["https:\/\/www.facebook.com\/nadiba.rahman?mibextid=ZbWKwL","https:\/\/www.linkedin.com\/in\/nadiba-rahman-443459171"],"url":"https:\/\/linuxsimply.com\/author\/nadiba\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/20316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/users\/314905"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=20316"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/20316\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/20317"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=20316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=20316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=20316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}