<?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>さくらたんどっとびーず &#187; Perl</title>
	<atom:link href="http://sakuratan.biz/archives/tag/perl/feed" rel="self" type="application/rss+xml" />
	<link>http://sakuratan.biz</link>
	<description>モロモロ工事中です</description>
	<lastBuildDate>Sun, 25 Jun 2023 12:51:51 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Unixのターミナルからビープ音を鳴らす方法</title>
		<link>http://sakuratan.biz/archives/4013</link>
		<comments>http://sakuratan.biz/archives/4013#comments</comments>
		<pubDate>Thu, 14 Apr 2011 06:29:09 +0000</pubDate>
		<dc:creator>さくら</dc:creator>
				<category><![CDATA[開発環境]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ターミナル]]></category>

		<guid isPermaLink="false">http://sakuratan.biz/?p=4013</guid>
		<description><![CDATA[先日30分ぐらいかかるスクリプトを実行していたのですが、終わったらビープ音で通知してくれると便利かなーと思って調べてみました。 ビープ音の文字コードは 0&#215;7 まず基本的なこととして、ASCII コードの 0&#215;7 は BEL となっており、（デバイス的に）適当なベル音を鳴らす文字コードとなっています。 つまり 0&#215;7 を出力したらビープ音が鳴るってことです。 シェルか... <div style="margin-top:1ex"><a href="http://sakuratan.biz/archives/4013">(続きを読む)</a></div>]]></description>
			<content:encoded><![CDATA[<p>先日30分ぐらいかかるスクリプトを実行していたのですが、終わったらビープ音で通知してくれると便利かなーと思って調べてみました。</p>
<h3>ビープ音の文字コードは 0&#215;7</h3>
<p>まず基本的なこととして、ASCII コードの 0&#215;7 は BEL となっており、（デバイス的に）適当なベル音を鳴らす文字コードとなっています。</p>
<p>つまり 0&#215;7 を出力したらビープ音が鳴るってことです。</p>
<h3>シェルから鳴らす</h3>
<p>シェルから鳴らす場合、echo コマンドを使います。コマンドラインから 0&#215;7 を指定するにはコントロールシーケンス ^G を入力します。</p>
<p>一般的なターミナルでは [CTRL]+v [CTRL]+g を連続して入力するとコントロールシーケンス ^G が入力できます。文字列 &#8220;^G&#8221; を入力しても鳴りませんので注意してください。</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #7a0874; font-weight: bold;">echo</span> ^G</div></div>
<p>printf コマンドがインストールされている環境では、以下のようにビープ音を鳴らすこともできます。</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">'\007'</span></div></div>
<h3>プログラミング言語から鳴らす</h3>
<p>0&#215;07 が出力できれば良いので、基本的にどのプログラミング言語からでもビープ音を鳴らすことができます。</p>
<p>代表的な LL 言語で鳴らす方法は以下のようになります。</p>
<div class="codecolorer-container perl dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># perl</span><br />
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\0</span>07&quot;</span><span style="color: #339933;">;</span></div></div>
<div class="codecolorer-container python dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;"># python</span><br />
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\0</span>07&quot;</span></div></div>
<div class="codecolorer-container ruby dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;"># ruby</span><br />
<span style="color:#CC0066; font-weight:bold;">print</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\0</span>07&quot;</span></div></div>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #660099; font-weight: bold;">\007</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>全部いっしょとか言わないのw</p>
<p>んでわ。</p>
]]></content:encoded>
			<wfw:commentRss>http://sakuratan.biz/archives/4013/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
