<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dmesg &#187; bash</title>
	<atom:link href="http://dmesg.org.ua/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://dmesg.org.ua</link>
	<description>заметки системного инженера</description>
	<lastBuildDate>Thu, 28 Jan 2010 09:06:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>noclobber</title>
		<link>http://dmesg.org.ua/2009/09/noclobber/</link>
		<comments>http://dmesg.org.ua/2009/09/noclobber/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 14:10:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Программирование]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://dmesg.org.ua/?p=122</guid>
		<description><![CDATA[$ set +o noclobber $ echo something &#62; my.file $ echo some more &#62; my.file $ set -o noclobber $ echo something &#62; my.file bash: my.file: cannot overwrite existing file $ echo some more &#62;&#62; my.file $ $ echo something &#62; my.file $ set -o noclobber $ echo some more &#62;&#124; my.file $ cat my.file [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">set</span> +o noclobber
$ <span style="color: #7a0874; font-weight: bold;">echo</span> something <span style="color: #000000; font-weight: bold;">&gt;</span> my.file
$ <span style="color: #7a0874; font-weight: bold;">echo</span> some <span style="color: #c20cb9; font-weight: bold;">more</span> <span style="color: #000000; font-weight: bold;">&gt;</span> my.file
$ <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-o</span> noclobber
$ <span style="color: #7a0874; font-weight: bold;">echo</span> something <span style="color: #000000; font-weight: bold;">&gt;</span> my.file
<span style="color: #c20cb9; font-weight: bold;">bash</span>: my.file: cannot overwrite existing <span style="color: #c20cb9; font-weight: bold;">file</span>
$ <span style="color: #7a0874; font-weight: bold;">echo</span> some <span style="color: #c20cb9; font-weight: bold;">more</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> my.file
$</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">echo</span> something <span style="color: #000000; font-weight: bold;">&gt;</span> my.file
$ <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-o</span> noclobber
$ <span style="color: #7a0874; font-weight: bold;">echo</span> some <span style="color: #c20cb9; font-weight: bold;">more</span> <span style="color: #000000; font-weight: bold;">&gt;|</span> my.file
$ <span style="color: #c20cb9; font-weight: bold;">cat</span> my.file
some <span style="color: #c20cb9; font-weight: bold;">more</span>
$ <span style="color: #7a0874; font-weight: bold;">echo</span> once again <span style="color: #000000; font-weight: bold;">&gt;</span> my.file
<span style="color: #c20cb9; font-weight: bold;">bash</span>: my.file: cannot overwrite existing <span style="color: #c20cb9; font-weight: bold;">file</span>
$</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dmesg.org.ua/2009/09/noclobber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Суммарный размер процессов, запущенных от Oracle</title>
		<link>http://dmesg.org.ua/2009/09/%d1%81%d1%83%d0%bc%d0%bc%d0%b0%d1%80%d0%bd%d1%8b%d0%b9-%d1%80%d0%b0%d0%b7%d0%bc%d0%b5%d1%80-%d0%bf%d1%80%d0%be%d1%86%d0%b5%d1%81%d1%81%d0%be%d0%b2-%d0%b7%d0%b0%d0%bf%d1%83%d1%89%d0%b5%d0%bd%d0%bd/</link>
		<comments>http://dmesg.org.ua/2009/09/%d1%81%d1%83%d0%bc%d0%bc%d0%b0%d1%80%d0%bd%d1%8b%d0%b9-%d1%80%d0%b0%d0%b7%d0%bc%d0%b5%d1%80-%d0%bf%d1%80%d0%be%d1%86%d0%b5%d1%81%d1%81%d0%be%d0%b2-%d0%b7%d0%b0%d0%bf%d1%83%d1%89%d0%b5%d0%bd%d0%bd/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 11:11:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Администрирование]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[HP-UX]]></category>
		<category><![CDATA[sh]]></category>

		<guid isPermaLink="false">http://dmesg.org.ua/?p=115</guid>
		<description><![CDATA[Для того чтобы узнать это на HP-UX можно воспользоваться следующим скриптом: #!/sbin/sh size=0 for i in `UNIX95= ps -e -o comm,vsz,user&#124; grep oracle&#124; awk '{print $2}'` do tmp=$i size=$&#40;&#40;$tmp+$size&#41;&#41; done &#160; echo &#34;scale=1;$size/1024&#34;&#124; bc -l Результатом будет количество мегабайт]]></description>
			<content:encoded><![CDATA[<p><img src="http://dmesg.org.ua/wp-content/uploads/2009/06/HPUXlogo.gif" alt="HPUXlogo" title="HPUXlogo" width="100" height="39" class="alignleft size-full wp-image-93" />Для того чтобы узнать это на HP-UX можно воспользоваться следующим скриптом:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/sbin/sh</span>
<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">size</span></span>=<span style="color: #000000;">0</span>
        <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">UNIX95</span>= <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-e</span> <span style="color: #660033;">-o</span> <span style="color: #c20cb9; font-weight: bold;">comm</span>,vsz,user<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> oracle<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #007800;">tmp</span>=<span style="color: #007800;">$i</span>
                <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">size</span></span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$tmp</span>+<span style="color: #007800;">$size</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;scale=1;<span style="color: #007800;">$size</span>/1024&quot;</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bc</span> <span style="color: #660033;">-l</span></pre></div></div>

<p>Результатом будет количество мегабайт</p>
]]></content:encoded>
			<wfw:commentRss>http://dmesg.org.ua/2009/09/%d1%81%d1%83%d0%bc%d0%bc%d0%b0%d1%80%d0%bd%d1%8b%d0%b9-%d1%80%d0%b0%d0%b7%d0%bc%d0%b5%d1%80-%d0%bf%d1%80%d0%be%d1%86%d0%b5%d1%81%d1%81%d0%be%d0%b2-%d0%b7%d0%b0%d0%bf%d1%83%d1%89%d0%b5%d0%bd%d0%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Скрипт для управления яркостью монитора</title>
		<link>http://dmesg.org.ua/2009/07/monitor-brightness-script/</link>
		<comments>http://dmesg.org.ua/2009/07/monitor-brightness-script/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 21:07:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Программирование]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://dmesg.org.ua/?p=66</guid>
		<description><![CDATA[Многие современные дистрибутивы Linux уже имеют при себе какую-то утилиту для регулировки яркости монитора в ноутбуке. Но поставив Slackware c KDE 3.5.10 , я такого устройства не обнаружил (может плохо искал). Пришлось получать удовольствие от написания небольшого скрипта, который теперь отлично справляется с яркостью. Запускается и выполняется из консоли, что гораздо удобнее чем настраивать яркость [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-84" style="margin: 5px;" title="icon" src="http://dmesg.org.ua/wp-content/uploads/2009/07/icon-150x150.png" alt="icon" width="84" height="84" />Многие современные дистрибутивы Linux уже имеют при себе какую-то утилиту  для регулировки яркости монитора в ноутбуке. Но поставив Slackware c KDE 3.5.10 , я такого устройства не обнаружил (может плохо искал). Пришлось  получать удовольствие от написания небольшого скрипта, который теперь отлично справляется с яркостью.<br />
Запускается и выполняется из консоли, что гораздо удобнее чем настраивать яркость тачпадом, а так же не зависит от того какое DE Вы используете.<br />
<span id="more-66"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">BRIGHT_FILE</span>=<span style="color: #ff0000;">'/proc/acpi/video/C085/C144/brightness'</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$BRIGHT_FILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;File <span style="color: #007800;">$BRIGHT_FILE</span> not found&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">CURRENT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> current <span style="color: #007800;">$BRIGHT_FILE</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">':'</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;q&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #c20cb9; font-weight: bold;">clear</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;brightness <span style="color: #007800;">$CURRENT</span>: &quot;</span>
        <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">0</span> <span style="color: #007800;">$CURRENT</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;#&quot;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span>
        <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span> var
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'-'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CURRENT</span>&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;brighness already set to min value&quot;</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;you can enlarge it or quit&quot;</span>
                        <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span> var
                        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'q'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #7a0874; font-weight: bold;">exit</span>
                        <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'+'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #007800;">CURRENT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$CURRENT</span>+<span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BRIGHT_FILE</span>
                        <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">CURRENT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$CURRENT</span>-<span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BRIGHT_FILE</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'+'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CURRENT</span>&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;brighness already set to max value&quot;</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;you can decrease it or quit&quot;</span>
                        <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span> var
                        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'q'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #7a0874; font-weight: bold;">exit</span>
                        <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$var</span>&quot;</span> == <span style="color: #ff0000;">'-'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #007800;">CURRENT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$CURRENT</span>-<span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BRIGHT_FILE</span>
                        <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">CURRENT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$CURRENT</span>+<span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$CURRENT</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BRIGHT_FILE</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dmesg.org.ua/2009/07/monitor-brightness-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

