<?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; bash</title>
	<atom:link href="http://blog.mktime.com/archive/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mktime.com</link>
	<description>修行の日々を淡々と</description>
	<lastBuildDate>Thu, 05 May 2011 07:39:25 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Linux From Scratch：環境設定</title>
		<link>http://blog.mktime.com/archive/332.html</link>
		<comments>http://blog.mktime.com/archive/332.html#comments</comments>
		<pubDate>Fri, 10 Sep 2010 11:53:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux From Scratch]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=332</guid>
		<description><![CDATA[いまはlfsユーザでログインしている。 これからlfsユーザでパッケージのビルドを行うが、その前にlfsユーザの環境を整える必要がある。 この作業はホストシステムの環境や設定がビルド内容に影響を与えないようにするためである。 まず、lfsユーザが使用するシェルを/bin/bashに固定する設定を~/.bash_profileに記述する。 cat > ~/.bash_profile ~/.bashrc]]></description>
			<content:encoded><![CDATA[<p>いまはlfsユーザでログインしている。<br />
これからlfsユーザでパッケージのビルドを行うが、その前にlfsユーザの環境を整える必要がある。</p>
<p>この作業はホストシステムの環境や設定がビルド内容に影響を与えないようにするためである。<br />
まず、lfsユーザが使用するシェルを/bin/bashに固定する設定を~/.bash_profileに記述する。</p>
<pre class="console">
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='u:w$ ' /bin/bash
EOF
</pre>
<p>このあと起動するシェルはbashとなる。<br />
bash起動時に実行される.bashrcファイルに以下の設定を記述する。</p>
<div class="file">~/.bashrc</div>
<pre class="file">
cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
EOF
</pre>
<p>これらは今後使用する環境変数と、ホスト環境の設定によって動作が変わることを防ぐための設定である。</p>
<p>sourceコマンドで設定を即座に反映する。</p>
<pre class="console">
source ~/.bash_profile
</pre>
<p>以上の設定を行った後、この環境にはこれだけの環境変数が設定されている。</p>
<pre class="console">
lfs@ubuntu-vm:~$ env
SHELL=/bin/bash
TERM=xterm
LC_ALL=POSIX
USER=lfs
LFS=/mnt/lfs
MAIL=/var/mail/lfs
PATH=/tools/bin:/bin:/usr/bin
PWD=/home/lfs
LANG=ja_JP.UTF-8
LFS_TGT=i686-lfs-linux-gnu
SHLVL=1
HOME=/home/lfs
LOGNAME=lfs
_=/usr/bin/env
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/332.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.bashrcと.bash_profile</title>
		<link>http://blog.mktime.com/archive/6.html</link>
		<comments>http://blog.mktime.com/archive/6.html#comments</comments>
		<pubDate>Tue, 08 Jul 2008 00:10:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[profile]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=4</guid>
		<description><![CDATA[.bashrcはbashを起動する度に読み込まれる。/etc/bashrcを読み込む。 .bash_profileはログインしたときに読み込まれる。/etc/bash_profileを読み込む。ログインしたときは.bashrcも読み込む。 .bashrcに記述したものは再ログインしなくても、bashコマンドでbashを起動するだけで反映される。 .bash_profileの変更はは再ログインしたときに読み込まれる。 以上の違いから環境変数は.bash_profile、エイリアスは.bashrcに書くのが一般的らしい。 sourceコマンドで.bashrc、.bash_profileを再読込するならどっちでも同じなので 全部.bashrcに書いてもかまわない。]]></description>
			<content:encoded><![CDATA[<p><span>.bashrcはbashを起動する度に読み込まれる。/etc/bashrcを読み込む。<br />
.bash_profileはログインしたときに読み込まれる。/etc/bash_profileを読み込む。ログインしたときは.bashrcも読み込む。</span></p>
<p>.bashrcに記述したものは再ログインしなくても、bashコマンドでbashを起動するだけで反映される。</p>
<p>.bash_profileの変更はは再ログインしたときに読み込まれる。</p>
<p>以上の違いから環境変数は.bash_profile、エイリアスは.bashrcに書くのが一般的らしい。</p>
<p>sourceコマンドで.bashrc、.bash_profileを再読込するならどっちでも同じなので<br />
全部.bashrcに書いてもかまわない。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/6.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

