<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Ural penguins - Сообщения с тегом fortune</title>
  <id>http://uralbash.ru/blog/tag/fortune/atom.xml</id>
  <updated>2012-11-11T16:46:00Z</updated>
  <link href="http://uralbash.ru/" />
  <link href="http://uralbash.ru/blog/tag/fortune/atom.xml" rel="self" />
  <generator uri="http://ablog.readthedocs.org" version="0.8.4">ABlog</generator>
  <entry xml:base="http://uralbash.ru/blog/tag/fortune/atom.xml">
    <title type="text">корова говорит fortune</title>
    <id>http://uralbash.ru/articles/2012/fortune/</id>
    <updated>2012-11-11T16:46:00Z</updated>
    <published>2012-11-11T16:46:00Z</published>
    <link href="http://uralbash.ru/articles/2012/fortune/" />
    <author>
      <name>Uralbash</name>
    </author>
    <content type="html">&lt;div class=&quot;section&quot; id=&quot;fortune&quot;&gt;

&lt;div class=&quot;highlight-bash&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;lt; ta-ta-taaa ta-ta tataaaa &amp;gt;
 --------------------------
   &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;        __------~~-,
    &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;     ,&lt;span class=&quot;s1&quot;&gt;&amp;#39;            ,&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;          /               \&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;         /                :&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;        |                  &amp;#39;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;                  &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;                  &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;   _--           &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
         _&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;-.     .-.   &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt;
         o&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;/o/       _.   &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
         /  ~          &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
       &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;____@&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;  ___~    &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;===&lt;/span&gt;~~~.&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
       _______.--~     &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
       &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;_______       &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
                &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;     &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;
              __/-___-- -__
             /            _ &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;мой скрипт в &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.bashrc&lt;/span&gt;&lt;/code&gt; для животного говорящего цитаты при открытии
терминала.&lt;/p&gt;
&lt;div class=&quot;highlight-bash&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cowperson&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;cowsay -l &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; sed &lt;span class=&quot;s1&quot;&gt;&amp;#39;1,1d&amp;#39;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; sed &lt;span class=&quot;s1&quot;&gt;&amp;#39;s/ /\n/g&amp;#39;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; shuf -n &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
fortune &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; cowsay -f &lt;span class=&quot;nv&quot;&gt;$cowperson&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;По порядку:&lt;/p&gt;
&lt;div class=&quot;line-block&quot;&gt;
&lt;div class=&quot;line&quot;&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cowperson&lt;/span&gt;&lt;/code&gt; - это выбор персонажа по рэндому&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;cowsay&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;-l&lt;/span&gt;&lt;/code&gt; - список всех персонажей&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;'1,1d'&lt;/span&gt;&lt;/code&gt; - удаление первой служебной строки с расположением папки с файлами &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;.cow&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;'s/&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;/\n/g'&lt;/span&gt;&lt;/code&gt; -  преобразование слов разделенных пробелами в строки (принцип как и в &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;vim&lt;/span&gt;&lt;/code&gt; команда замены &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;s/&lt;/span&gt;&lt;/code&gt; далее чего &amp;#8220;пробел&amp;#8221; на &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;\n&lt;/span&gt;&lt;/code&gt;)&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;shuf&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;1&lt;/span&gt;&lt;/code&gt; - случайный выбор строки&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;fortune&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;cowsay&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;$cowperson&lt;/span&gt;&lt;/code&gt; рисует случайного персонажа с цитатой переданной из фортуне&lt;/p&gt;
&lt;p&gt;Иногда случаются довольно забавные сочетания :)&lt;/p&gt;
&lt;img alt=&quot;_static/2012/fortune1.png&quot; class=&quot;align-center&quot; src=&quot;_static/2012/fortune1.png&quot; /&gt;
&lt;img alt=&quot;_static/2012/fortune2.png&quot; class=&quot;align-center&quot; src=&quot;_static/2012/fortune2.png&quot; /&gt;
&lt;/div&gt;
</content>
  </entry>
</feed>
