{"id":360,"date":"2024-02-07T21:58:51","date_gmt":"2024-02-07T13:58:51","guid":{"rendered":"https:\/\/boostup.cf\/?p=360"},"modified":"2026-05-27T18:23:06","modified_gmt":"2026-05-27T10:23:06","slug":"bash","status":"publish","type":"post","link":"https:\/\/189505.xyz\/?p=360","title":{"rendered":"bash"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 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\">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\" area-label=\"ez-toc-toggle-icon-1\"><label for=\"item-6a1cc9b8b840f\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><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><\/label><input  type=\"checkbox\" id=\"item-6a1cc9b8b840f\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/189505.xyz\/?p=360\/#array\" title=\"\narray \n\">\narray \n<\/a><ul class='ez-toc-list-level-2'><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/189505.xyz\/?p=360\/#%E5%A3%B0%E6%98%8E%E6%95%B0%E7%BB%84%EF%BC%8C%E9%81%8D%E5%8E%86\" title=\"\n\u58f0\u660e\u6570\u7ec4\uff0c\u904d\u5386 \n\">\n\u58f0\u660e\u6570\u7ec4\uff0c\u904d\u5386 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/189505.xyz\/?p=360\/#%E9%81%8D%E5%8E%86idx\" title=\"\n\u904d\u5386idx \n\">\n\u904d\u5386idx \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/189505.xyz\/?p=360\/#%E6%95%B0%E7%BB%84%E9%95%BF%E5%BA%A6\" title=\"\n\u6570\u7ec4\u957f\u5ea6 \n\">\n\u6570\u7ec4\u957f\u5ea6 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/189505.xyz\/?p=360\/#%E5%92%8C%E5%8C%BA%E5%88%AB\" title=\"\n*\u548c@\u533a\u522b \n\">\n*\u548c@\u533a\u522b \n<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/189505.xyz\/?p=360\/#git-bash%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AEtitle\" title=\"git-bash\u5982\u4f55\u8bbe\u7f6etitle\">git-bash\u5982\u4f55\u8bbe\u7f6etitle<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"array\"><\/span>\narray<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"%E5%A3%B0%E6%98%8E%E6%95%B0%E7%BB%84%EF%BC%8C%E9%81%8D%E5%8E%86\"><\/span>\n\u58f0\u660e\u6570\u7ec4\uff0c\u904d\u5386<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>allThreads=(1 2 4 8 16 32 64 128)\necho &quot;----------------------------------------simple&quot;\nfor t in ${allThreads[@]}; do\necho $t\ndone\n\noutput:\n----------------------------------------simple\n1\n2\n4\n8\n16\n32\n64\n128\n<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E9%81%8D%E5%8E%86idx\"><\/span>\n\u904d\u5386idx<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>echo &quot;----------------------------------------idx&quot;\nfor t in ${!allThreads[@]}; do\necho $t\ndone\n\n----------------------------------------idx\n0\n1\n2\n3\n4\n5\n6\n7\n<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E6%95%B0%E7%BB%84%E9%95%BF%E5%BA%A6\"><\/span>\n\u6570\u7ec4\u957f\u5ea6<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>echo &quot;array length:${!allThreads[@]}&quot;<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E5%92%8C%E5%8C%BA%E5%88%AB\"><\/span>\n*\u548c@\u533a\u522b<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code>for t in &quot;${allThreads[@]}&quot;; do\necho &quot;t @ is:$t&quot;\ndone\n\nfor t in &quot;${allThreads[*]}&quot;; do\necho &quot;star t is:$t&quot;\ndone\n\necho &quot;@t is|${allThreads[@]}|&quot;\necho &quot;* is|${allThreads[*]}|&quot;\nIFS=,; echo &quot;* is|${allThreads[*]}|&quot;\n\noutput:\nt @ is:1\nt @ is:2\nt @ is:4\nt @ is:8\nt @ is:16\nt @ is:32\nt @ is:64\nt @ is:128\nstar t is:1 2 4 8 16 32 64 128\n@t is|1 2 4 8 16 32 64 128|\n* is|1 2 4 8 16 32 64 128|\n* is|1,2,4,8,16,32,64,128|\n<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"git-bash%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AEtitle\"><\/span>git-bash\u5982\u4f55\u8bbe\u7f6etitle<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5728  ~\/.bashrc\u5199\u5165\uff1a<\/p>\n<pre><code>title() { echo -ne &quot;\\e]0;$1\\a&quot;; }<\/code><\/pre>\n<p>\u7136\u540e\u5728\u7ec8\u7aef\u8fd0\u884c<\/p>\n<pre><code>title &quot;my title&quot;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>array \u58f0\u660e\u6570\u7ec4\uff0c\u904d\u5386 allThreads=(1 2 4 8 16 32 64 128) echo &#038;q &#8230; <a title=\"bash\" class=\"read-more\" href=\"https:\/\/189505.xyz\/?p=360\" aria-label=\"More on bash\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/360"}],"collection":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":7,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}