<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[如何知道当前正在使用的 shell 是哪个？]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Fri, 04 Dec 2015 00:05:17 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景: 我经常在命令行中切换 shell。是否有一个快速简便的方法来找出我当前正在使用的 shell 呢？此外，我怎么能找到当前 shell 的版本？<br/><br/>其一，一个名为 &quot;$$&quot; 的特殊参数表示当前你正在运行的 shell 实例的 PID。此参数是只读的，不能被修改。所以，下面的命令也将显示你正在运行的 shell 的名字：<br/>$ ps -p $$<br/>PID TTY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIME CMD<br/>21666 pts/4&nbsp;&nbsp;&nbsp;&nbsp;00:00:00 bash<br/>上述命令可在所有可用的 shell 中工作。<br/>如果你不使用 csh，找到当前使用的 shell 的另外一个办法是使用特殊参数 “$0” ，它表示当前正在运行的 shell 或 shell 脚本的名称。这是 Bash 的一个特殊参数，但也可用在其他 shell 中，如 sh、zsh、tcsh 或 dash。使用 echo 命令可以查看你目前正在使用的 shell 的名称。<br/>$ echo $0<br/>bash<br/>不要被一个叫做 $SHELL 的单独的环境变量所迷惑，它被设置为你的默认 shell 的完整路径。因此，这个变量并不一定指向你当前使用的 shell。例如，即使你在终端中调用不同的 shell，$SHELL 也保持不变。<br/>$ echo $SHELL<br/><br/>/bin/shell<br/><br/><br/>因此，找出当前的shell，你应该使用 $$ 或 $0，但不是 $SHELL。<br/>找出当前 Shell 的版本<br/>一旦你知道你使用的是哪个 shell，你可能想知道此 shell 的版本。为此，在命令行中输入 shell 并在后面加上 “--version” 参数可以查看版本信息。例如：<br/>对于bashshell:<br/>$ bash --version<br/><br/>GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)<br/>Copyright (C) 2013 Free Software Foundation, Inc.<br/>License GPLv3+: GNU GPL version 3 or later<br/><br/>This is free software; you are free to change and redistribute it.<br/>There is NO WARRANTY, to the extent permitted by law.<br/>对于zshshell:<br/>$ zsh --version<br/><br/>zsh 5.0.7 (x86_64-pc-linux-gnu)<br/>对于tcshshell: $ tcsh --version<br/>tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,nd,color,filec<br/>对于某些 shell，你还可以使用 shell 特定的变量（例如，$BASHVERSION 或 $ZSHVERSION）。<br/>$ echo $BASH_VERSION<br/><br/>4.3.8(1)-release<br/><br/>摘自:http://m.toutiao.com/i6221626512869687810/?tt_from=android_share&amp;iid=3283494589&amp;app=news_article&amp;utm_medium=toutiao_android&amp;utm_campaign=client_share
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] 如何知道当前正在使用的 shell 是哪个？]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>