{"id":795,"date":"2014-10-25T15:31:20","date_gmt":"2014-10-25T22:31:20","guid":{"rendered":"http:\/\/yan.lalife.net\/?p=795"},"modified":"2026-01-20T05:08:02","modified_gmt":"2026-01-20T05:08:02","slug":"bash-scripts","status":"publish","type":"post","link":"http:\/\/www.lalife.net\/?p=795","title":{"rendered":"Bash scripts"},"content":{"rendered":"<p><strong>Change upper case to lower case<\/strong><\/p>\n<blockquote><p>#echo &#8216;TEST&#8217;|\/usr\/bin\/tr -s &#8216;[:upper:]&#8217; &#8216;[:lower:]&#8217;<br \/>\ntest<\/p><\/blockquote>\n<p><strong>Work with array<\/strong><\/p>\n<blockquote><p>IFS=$&#8217;\\n&#8217;  ##here tells how to devide the output, default is space<br \/>\n           ##but I want to put each line into a array<br \/>\nfiles=($(ls .\/)  ##put file names into an array using ()<br \/>\nfor (( i=0;i<${#files[@]};i++ ));do\n   mv $files[$i] $files[$i]_OLD\ndone<\/p><\/blockquote>\n<p><strong>Match pattern<\/strong><\/p>\n<blockquote><p>if [[ $string =~ &#8220;data&#8221; ]];do<br \/>\n   echo &#8220;$string contains data&#8221;<br \/>\ndone<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Change upper case to lower case #echo &#8216;TEST&#8217;|\/usr\/bin\/tr -s &#8216;[:upper:]&#8217; &#8216;[:lower:]&#8217; test Work with array IFS=$&#8217;\\n&#8217; ##here tells how to devide the output, default is space ##but I want to put each line into a array files=($(ls .\/) ##put file &hellip; <a href=\"http:\/\/www.lalife.net\/?p=795\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-795","post","type-post","status-publish","format-standard","hentry","category-shell"],"_links":{"self":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=795"}],"version-history":[{"count":1,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":1834,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/795\/revisions\/1834"}],"wp:attachment":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}