<?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>Terrysco&#039;s Blog &#187; bash</title>
	<atom:link href="http://www.terrysco.com/node/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://www.terrysco.com</link>
	<description>仅关注于互联网行业， Linux平台开发。</description>
	<lastBuildDate>Sat, 05 Nov 2011 21:24:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>贴我的.bashrc文件上来</title>
		<link>http://www.terrysco.com/node/my-bashrc.html</link>
		<comments>http://www.terrysco.com/node/my-bashrc.html#comments</comments>
		<pubDate>Mon, 10 Nov 2008 16:17:20 +0000</pubDate>
		<dc:creator>terrysco</dc:creator>
				<category><![CDATA[Linux/Mac/DB]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.anyliv.com/www.terrysco.com/?p=56</guid>
		<description><![CDATA[<p>鉴于好多朋友需要bashrc文件的配置，这个文件是长期设置累积的。有shell颜色的配置，自动补全，以及一些常用alias设置。</p><p># /etc/bash/bashrc<br />#<br /># This file is sourced by all *interactive* bash shells on startup,<br /># including some apparently interactive shells such as scp and rcp<br />...</p>
]]></description>
			<content:encoded><![CDATA[<p>鉴于好多朋友需要bashrc文件的配置，这个文件是长期设置累积的。有shell颜色的配置，自动补全，以及一些常用alias设置。</p>
<p># /etc/bash/bashrc<br />#<br /># This file is sourced by all *interactive* bash shells on startup,<br /># including some apparently interactive shells such as scp and rcp<br /># that can&#8217;t tolerate any output.&nbsp; So make sure this doesn&#8217;t display<br /># anything or bad things will happen !</p>
<p># Test for an interactive shell.&nbsp; There is no need to set anything<br /># past this point for scp and rcp, and it&#8217;s important to refrain from<br /># outputting anything in those cases.</p>
<p>if [[ $- != *i* ]] ; then<br />&nbsp;&nbsp;&nbsp; # Shell is non-interactive.&nbsp; Be done now!<br />&nbsp;&nbsp;&nbsp; return<br />fi</p>
<p># Bash won&#8217;t get SIGWINCH if another process is in the foreground.<br /># Enable checkwinsize so that bash will check the terminal size when<br /># it regains control.&nbsp; #65623<br /># http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)<br />shopt -s checkwinsize</p>
<p># Enable history appending instead of overwriting.&nbsp; #139609<br />shopt -s histappend</p>
<p># Change the window title of X terminals <br />case ${TERM} in<br />&nbsp;&nbsp;&nbsp; xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PROMPT_COMMAND=&#8217;echo -ne &quot;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007&quot;&#8217;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ;;<br />&nbsp;&nbsp;&nbsp; screen)<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PROMPT_COMMAND=&#8217;echo -ne &quot;\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\&quot;&#8217;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ;;<br />esac</p>
<p>use_color=false</p>
<p># Set colorful PS1 only on colorful terminals.<br /># dircolors &#8211;print-database uses its own built-in database<br /># instead of using /etc/DIR_COLORS.&nbsp; Try to use the external file<br /># first to take advantage of user additions.&nbsp; Use internal bash<br /># globbing instead of external grep binary.<br />safe_term=${TERM//[^[:alnum:]]/?}&nbsp;&nbsp; # sanitize TERM<br />match_lhs=&quot;&quot;<br />[[ -f ~/.dir_colors&nbsp;&nbsp; ]] &amp;&amp; match_lhs=&quot;${match_lhs}$(&lt;~/.dir_colors)&quot;<br />[[ -f /etc/DIR_COLORS ]] &amp;&amp; match_lhs=&quot;${match_lhs}$(&lt;/etc/DIR_COLORS)&quot;<br />[[ -z ${match_lhs}&nbsp;&nbsp;&nbsp; ]] \<br />&nbsp;&nbsp;&nbsp; &amp;&amp; type -P dircolors &gt;/dev/null \<br />&nbsp;&nbsp;&nbsp; &amp;&amp; match_lhs=$(dircolors &#8211;print-database)<br />[[ $'\n'${match_lhs} == *$'\n'&quot;TERM &quot;${safe_term}* ]] &amp;&amp; use_color=true</p>
<p>if ${use_color} ; then<br />&nbsp;&nbsp;&nbsp; # Enable colors for ls, etc.&nbsp; Prefer ~/.dir_colors #64489<br />&nbsp;&nbsp;&nbsp; if type -P dircolors &gt;/dev/null ; then<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if [[ -f ~/.dir_colors ]] ; then<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; eval $(dircolors -b ~/.dir_colors)<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif [[ -f /etc/DIR_COLORS ]] ; then<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; eval $(dircolors -b /etc/DIR_COLORS)<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fi<br />&nbsp;&nbsp;&nbsp; fi</p>
<p>&nbsp;&nbsp;&nbsp; if [[ ${EUID} == 0 ]] ; then<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PS1=&#8217;\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] &#8216;<br />&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PS1=&#8217;\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] &#8216;<br />&nbsp;&nbsp;&nbsp; fi</p>
<p>&nbsp;&nbsp;&nbsp; alias ls=&#8217;ls &#8211;color=auto&#8217;<br />&nbsp;&nbsp;&nbsp; alias grep=&#8217;grep &#8211;colour=auto&#8217;<br />else<br />&nbsp;&nbsp;&nbsp; if [[ ${EUID} == 0 ]] ; then<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # show root@ when we don&#8217;t have colors<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PS1=&#8217;\u@\h \W \$ &#8216;<br />&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PS1=&#8217;\u@\h \w \$ &#8216;<br />&nbsp;&nbsp;&nbsp; fi<br />fi</p>
<p># Try to keep environment pollution down, EPA loves us.<br />unset use_color safe_term match_lhs<br />alias ll=&#8217;ls -l &#8211;color=tty&#8217;<br /># Java develop<br />export JAVA_HOME=/opt/java<br />export PATH=$PATH:$JAVA_HOME/bin<br />export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar<br />export OOO_FORCE_DESKTOP=gnome<br />if [ -f /etc/bash_completion ]; then<br />&nbsp;&nbsp;&nbsp; . /etc/bash_completion<br />fi<br />&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.terrysco.com/node/my-bashrc.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于~/.bashrc的郁闷问题</title>
		<link>http://www.terrysco.com/node/arch-bashrc.html</link>
		<comments>http://www.terrysco.com/node/arch-bashrc.html#comments</comments>
		<pubDate>Wed, 15 Oct 2008 22:36:49 +0000</pubDate>
		<dc:creator>terrysco</dc:creator>
				<category><![CDATA[Linux/Mac/DB]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.anyliv.com/www.terrysco.com/?p=47</guid>
		<description><![CDATA[<p>机器上的archlinux安装了这么久，最近发现一个棘手的问题。～/.bashrc里面的一些设置，比如alias命令的设置&#8220;不起作用&#8221;，新开一个终端都要source一下才起作用。因为这个文件里面设置了大量的使用习惯问题，所以每次要souce很麻烦。我们都知道<font id="zoom" class="f14">每个用户都可使用</font><font id="zoom" class="f14">~/.bash_profile</font><font id="zoom" class="f14">输入专用于自己使用的shell信息，当用户登录时，该文件仅仅执行一次，并且默认情况下，他设置一些环境变量，执行用户的.bashrc文件。而这个<br />...</font></p><p>&#160;</p>
]]></description>
			<content:encoded><![CDATA[<p>机器上的archlinux安装了这么久，最近发现一个棘手的问题。～/.bashrc里面的一些设置，比如alias命令的设置&ldquo;不起作用&rdquo;，新开一个终端都要source一下才起作用。因为这个文件里面设置了大量的使用习惯问题，所以每次要souce很麻烦。我们都知道<font id="zoom" class="f14">每个用户都可使用</font><font id="zoom" class="f14">~/.bash_profile</font><font id="zoom" class="f14">输入专用于自己使用的shell信息，当用户登录时，该文件仅仅执行一次，并且默认情况下，他设置一些环境变量，执行用户的.bashrc文件。而这个<br />~/.bashrc文件包含专用于你的bash shell的bash信息，当登录时以及每次打开新的shell时，该文件被读取。<font color="blue"><br /></font></font></p>
<p><font class="f14">大体原理就是这个，那为什么我这个文件不起作用呢？这时候想到一个可笑的问题：难道我用的不是bash？echo了下SHELL环境变量，发现是sh，当时汗颜。原来我刚装好arch的时候创建这个用户没有指定shell为bash。</font></p>
<p>知道问题所在了，解决办法就是更改当前用户的shell。最好不要编辑/etc/passwd文件，而是使用chsh命令，应该是（change shell）的意思吧。</p>
<p>chsh -s /bin/bash terrysco</p>
<p>问题解决。。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.terrysco.com/node/arch-bashrc.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

