{"id":221273,"date":"2014-04-29T13:45:09","date_gmt":"2014-04-29T09:45:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=221273"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=221273","title":{"rendered":"<span class=\"post_title\">\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Bash<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u042d\u0442\u0438 \u043f\u0440\u0438\u0435\u043c\u044b \u0431\u044b\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Google \u00abTesting on the Toilet\u00bb (\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0442\u0443\u0430\u043b\u0435\u0442\u0435 \u2014 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u0441\u0442\u043e\u0432\u043e\u043a \u0432 \u0442\u0443\u0430\u043b\u0435\u0442\u0430\u0445, \u0447\u0442\u043e \u0431\u044b \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e \u0442\u0435\u0441\u0442\u0430\u0445).<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u044b.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h5>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h5>\n<p>  \u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0440\u043e\u043a  <\/p>\n<pre><code class=\"bash\">#!\/bin\/bash set -o nounset set -o errexit <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a<br \/>  1) \u041f\u043e\u043f\u044b\u0442\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<br \/>  2) \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434<br \/>  \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e, \u0438 \u043d\u0430\u0441 \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"bash\">if ! &lt;possible failing command&gt; ; then     echo &quot;failure ignored&quot; fi <\/code><\/pre>\n<p>  \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043a\u043e\u0434 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u201cmkdir -p\u201d \u0438 \u201crm -f\u201d.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u043f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c (command1 | command 2 | command3) \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:   <\/p>\n<pre><code class=\"bash\">(.\/failing_command && echo A) <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &#8216;&#038;&#038;&#8217; \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u2014 &#8216;http:\/\/fvue.nl\/wiki\/Bash:_Error_handling&#8217;<\/p>\n<h5>\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/h5>\n<p>  Bash \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430:<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 1:   <\/p>\n<pre><code class=\"bash\">ExtractBashComments() {     egrep &quot;^#&quot; }  cat myscript.sh | ExtractBashComments | wc  <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\">comments=$(ExtractBashComments &lt; myscript.sh) <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 2:  <\/p>\n<pre><code class=\"bash\">SumLines() {  # iterating over stdin - similar to awk            local sum=0     local line=\u201d\u201d     while read line ; do         sum=$((${sum} + ${line}))     done     echo ${sum} }  SumLines &lt; data_one_number_per_line.txt  <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 3:  <\/p>\n<pre><code class=\"bash\">log() {  # classic logger     local prefix=&quot;[$(date +%Y\/%m\/%d\\ %H:%M:%S)]: &quot;    echo &quot;${prefix} $@&quot; &gt;&2 }  log &quot;INFO&quot; &quot;a message&quot; <\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432\u0435\u0441\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\/\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00abmain\u00bb \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430.<\/p>\n<h5>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h5>\n<p>  Bash \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432, \u0441\u0430\u043c\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435:<br \/>  <b>local<\/b> (\u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439)<br \/>  <b>readonly<\/b> (\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443)  <\/p>\n<pre><code class=\"bash\">## \u0415\u0441\u043b\u0438 DEFAULT_VAL \u0443\u0436\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c '-7' readonly DEFAULT_VAL=${DEFAULT_VAL:-7}   myfunc() {    # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439    local some_var=${DEFAULT_VAL}    ... } <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 readonly \u0438\u0437 \u0443\u0436\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">x=5 x=6 readonly x x=7   # failure <\/code><\/pre>\n<p>   \u0421\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u044b \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043b\u0438\u0431\u043e local, \u043b\u0438\u0431\u043e readonly, \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u0441\u043d\u0438\u0437\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 $() \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0445 \u043a\u0430\u0432\u044b\u0447\u0435\u043a &#171;<\/h5>\n<p>  \u041e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u043f\u043b\u043e\u0445\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0448\u0440\u0438\u0444\u0442\u0430\u0445 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u043d\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u0440\u043d\u044b\u043c\u0438 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u043c\u0438.<br \/>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f $() \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u0435\u0437 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0431\u043e\u043b\u0438 \u0441 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c:  <\/p>\n<pre><code class=\"bash\"># \u043e\u0431\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442: A-B-C-D echo &quot;A-`echo B-\\`echo C-\\\\\\`echo D\\\\\\`\\``&quot; echo &quot;A-$(echo B-$(echo C-$(echo D)))&quot; <\/code><\/pre>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 [[]] \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u0438\u043d\u0430\u0440\u043d\u044b\u0445 []<\/h5>\n<p>  \u0414\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0443\u0442\u0435\u0439 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"bash\"> $ [ a &lt; b ]  -bash: b: No such file or directory  $ [[ a &lt; b ]] <\/code><\/pre>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:  <\/p>\n<pre><code class=\"bash\">[ &quot;${name}&quot; \\&gt; &quot;a&quot; -o ${name} \\&lt; &quot;m&quot; ]  [[ &quot;${name}&quot; &gt; &quot;a&quot; && &quot;${name}&quot; &lt; &quot;m&quot;  ]] <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p>  \u041d\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b:  <\/p>\n<ul>\n<li><b>||<\/b> \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0418\u041b\u0418 (logical or) \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0432\u043e\u0439\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438.<\/li>\n<li><b>&#038;&#038;<\/b> \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0418 (logical and) \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0432\u043e\u0439\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438.<\/li>\n<li><b>&lt;<\/b> \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (string comparison) \u2014 \u0441 \u0434\u0432\u043e\u0439\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/li>\n<li><b>==<\/b> \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 (string matching with globbing) \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0432\u043e\u0439\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438.<\/li>\n<li><b>=~<\/b> \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (string matching with regular expressions) \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0432\u043e\u0439\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438.<\/li>\n<\/ul>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b:  <\/p>\n<ul>\n<li><b>-lt<\/b> \u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 (numerical comparison)<\/li>\n<li><b>-n<\/b> \u0421\u0442\u0440\u043e\u043a\u043e\u0432\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u043f\u0443\u0441\u0442\u0430 (string is non-empty)<\/li>\n<li><b>-z<\/b> \u0421\u0442\u0440\u043e\u043a\u043e\u0432\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043f\u0443\u0441\u0442\u0430 (string is empty)<\/li>\n<li><b>-eq<\/b> \u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e (numerical equality)<\/li>\n<li><b>-ne<\/b> \u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0435 \u043d\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e (numerical inequality)<\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b:  <\/p>\n<pre><code class=\"bash\">t=&quot;abc123&quot; [[ &quot;$t&quot; == abc* ]]         # true (globbing) [[ &quot;$t&quot; == &quot;abc*&quot; ]]       # false (literal matching) [[ &quot;$t&quot; =~ [abc]+[123]+ ]] # true (regular expression) [[ &quot;$t&quot; =~ &quot;abc*&quot; ]]       # false (literal matching) <\/code><\/pre>\n<p>  \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 bash 3.2 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u0435\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0431\u0435\u043b\u044b, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0435\u0435\u0440\u043c\u0435\u043d\u043d\u0443\u044e:  <\/p>\n<pre><code class=\"bash\">r=&quot;a b+&quot; [[ &quot;a bbb&quot; =~ $r ]]        # true <\/code><\/pre>\n<p>  \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 case:  <\/p>\n<pre><code class=\"bash\">case $t in abc*)  &lt;action&gt; ;; esac <\/code><\/pre>\n<h5>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438:<\/h5>\n<p>  \u0412 bash \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0435\u043d\u043d\u044b\u0445) \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438:<br \/>  \u0411\u0430\u0437\u043e\u0432\u044b\u0435:  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;   len=&quot;${#f}&quot; # = 20 (\u0434\u043b\u0438\u043d\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439)  # \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439: ${&lt;\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f&gt;:&lt;\u043d\u0430\u0447\u0430\u043b\u043e_\u0443\u0447\u0430\u0441\u0442\u043a\u0430&gt;} \u0438\u043b\u0438 ${&lt;\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f&gt;:&lt;\u043d\u0430\u0447\u0430\u043b\u043e_\u0443\u0447\u0430\u0441\u0442\u043a\u0430&gt;:&lt;\u0440\u0430\u0437\u043c\u0435\u0440_\u0443\u0447\u0430\u0441\u0442\u043a\u0430&gt;} slice1=&quot;${f:6}&quot; # = &quot;path2\/file.ext&quot; slice2=&quot;${f:6:5}&quot; # = &quot;path2&quot; slice3=&quot;${f: -8}&quot; # = &quot;file.ext&quot; (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0435\u0440\u0435\u0434 \u0437\u043d\u0430\u043a\u043e\u043c '-') pos=6 len=5 slice4=&quot;${f:${pos}:${len}}&quot; # = &quot;path2&quot; <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u0430 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;   single_subst=&quot;${f\/path?\/x}&quot;   # = &quot;x\/path2\/file.ext&quot; (\u0437\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f) global_subst=&quot;${f\/\/path?\/x}&quot;  # = &quot;x\/x\/file.ext&quot; (\u0437\u0430\u043c\u0435\u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439) <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  readonly DIR_SEP=&quot;\/&quot; array=(${f\/\/${DIR_SEP}\/ }) second_dir=&quot;${arrray[1]}&quot;     # = path2 <\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  <\/code><\/pre>\n<p>  # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  extension=&quot;${f#*.}&quot;  # = &quot;ext&quot;  <\/code><\/pre>\n<p>  # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  filename=&quot;${f##*\/}&quot;  # = &quot;file.ext&quot;  <\/code><\/pre>\n<p>  # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  dirname=&quot;${f%\/*}&quot;    # = &quot;path1\/path2&quot;  <\/code><\/pre>\n<p>  # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"bash\">f=&quot;path1\/path2\/file.ext&quot;  root=&quot;${f%%\/*}&quot;      # = &quot;path1&quot; <\/code><\/pre>\n<h5>\u0418\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/h5>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0436\u0438\u0434\u0430\u044e\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0441 \u043d\u0438\u043c\u0438 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &#8216;&lt;()&#8217;, \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432 \u043d\u0435\u0447\u0442\u043e \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430:<br \/>  # \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0434\u0432\u0430 URLa \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 diff  <\/p>\n<pre><code class=\"bash\">diff &lt;(wget -O - url1) &lt;(wget -O - url2) <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:<br \/>  # MARKER \u2014 \u043b\u044e\u0431\u043e\u0435 \u0441\u043b\u043e\u0432\u043e.  <\/p>\n<pre><code class=\"bash\">command  &lt;&lt; MARKER ... ${var} $(cmd) ... MARKER <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0442\u043e \u043c\u0430\u0440\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438:<br \/>  # \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 &#8216;$var&#8217; \u0430 \u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439   <\/p>\n<pre><code class=\"bash\">var=&quot;text&quot; cat &lt;&lt; 'MARKER' ... $var ... MARKER <\/code><\/pre>\n<h5>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/h5>\n<p>  <\/p>\n<ul>\n<li>$0 \u0418\u043c\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (name of the script)<\/li>\n<li>$1 $2\u2026 $n \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0443\/\u0444\u043d\u0443\u043a\u0446\u0438\u0438 (positional parameters to script\/function)<\/li>\n<li>$$ PID \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (PID of the script)<\/li>\n<li>$! PID \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0432 \u0444\u043e\u043d\u0435(PID of the last command executed (and run in the background))<\/li>\n<li>$? \u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (exit status of the last command (${PIPESTATUS} for pipelined commands))<\/li>\n<li>$# \u041a\u043e\u043b\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u0443\/\u0444\u0443\u043d\u043a\u0446\u0438\u0438 (number of parameters to script\/function)<\/li>\n<li>$@ \u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0443\/\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043b\u043e\u0432 (sees arguments as separate word)<\/li>\n<li>$* \u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0443\/\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 (sees arguments as single word)<\/li>\n<li>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e:<\/li>\n<li>$* \u0420\u0435\u0434\u043a\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439<\/li>\n<li>$@ \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438<\/li>\n<li>$@ \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u2014 &quot;$@&quot;<\/li>\n<\/ul>\n<p>   \u041f\u0440\u0438\u043c\u0435\u0440:   <\/p>\n<pre><code class=\"bash\">for i in &quot;$@&quot;; do echo '$@ param:' $i; done for i in &quot;$*&quot;; do echo '$! param:' $i; done <\/code><\/pre>\n<p>   \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<pre><code class=\"bash\">bash .\/parameters.sh arg1 arg2 $@ param: arg1 $@ param: arg2 $! param: arg1 arg2 <\/code><\/pre>\n<h5>\u041e\u0442\u043b\u0430\u0434\u043a\u0430<\/h5>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 (\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0435\u0441\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043b\u044c\u0448\u0435 15 \u0441\u0435\u043a\u0443\u043d\u0434):   <\/p>\n<pre><code class=\"bash\">bash -n myscript.sh <\/code><\/pre>\n<p>  \u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430:  <\/p>\n<pre><code class=\"bash\">bash -v myscripts.sh <\/code><\/pre>\n<p>  \u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:  <\/p>\n<pre><code class=\"bash\">bash -x myscript.sh <\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b -v \u0438 -x \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">set -o verbose set -o xtrace <\/code><\/pre>\n<p>  <\/p>\n<h6>\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c shell \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/h6>\n<p>  <\/p>\n<ul>\n<li>\u0412\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043e\u0442\u0435\u043d \u0441\u0442\u0440\u043e\u043a.<\/li>\n<li>\u0412\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/li>\n<li>\u0412\u0430\u0441 \u0437\u0430\u0434\u043e\u043b\u0431\u0430\u043b\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0442\u0440\u0435\u0431\u0441\u0442\u0432\u0430\u043c\u0438 \u0441 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u043c\u0438 \u0438 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c.<\/li>\n<li>\u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\/\u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/li>\n<li>\u0423 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u044b \u0438 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u0430\u0439\u043f\u0430\u0445.<\/li>\n<li>\u0414\u043b\u044f \u0432\u0430\u0441 \u0432\u0430\u0436\u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\/\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u044f\u0437\u044b\u043a\u0438 \u044f\u0437\u044b\u043a\u0438 Python \u0438\u043b\u0438 Ruby.<br \/>  \u0421\u0441\u044b\u043b\u043a\u0438: <br \/>  Advanced Bash-Scripting Guide: <a href=\"http:\/\/tldp.org\/LDP\/abs\/html\/\">tldp.org\/LDP\/abs\/html\/<\/a><br \/>  Bash Reference Manual: <a href=\"http:\/\/www.gnu.org\/software\/bash\/manual\/bashref.html\">www.gnu.org\/software\/bash\/manual\/bashref.html<\/a><br \/>  \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438: <a href=\"http:\/\/robertmuth.blogspot.ru\/2012\/08\/better-bash-scripting-in-15-minutes.html\">robertmuth.blogspot.ru\/2012\/08\/better-bash-scripting-in-15-minutes.html<\/a> \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/221273\/\"> http:\/\/habrahabr.ru\/post\/221273\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u042d\u0442\u0438 \u043f\u0440\u0438\u0435\u043c\u044b \u0431\u044b\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Google \u00abTesting on the Toilet\u00bb (\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0442\u0443\u0430\u043b\u0435\u0442\u0435 \u2014 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u0441\u0442\u043e\u0432\u043e\u043a \u0432 \u0442\u0443\u0430\u043b\u0435\u0442\u0430\u0445, \u0447\u0442\u043e \u0431\u044b \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e \u0442\u0435\u0441\u0442\u0430\u0445).<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u044b.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-221273","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/221273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221273"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/221273\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}