<?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; shell</title>
	<atom:link href="http://guogoul.com/tag/shel/feed/" rel="self" type="application/rss+xml" />
	<link>http://guogoul.com</link>
	<description></description>
	<lastBuildDate>Wed, 07 Jul 2010 04:53:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>bash编程学习-基础(5)</title>
		<link>http://guogoul.com/2008/08/30/bashshell_5/</link>
		<comments>http://guogoul.com/2008/08/30/bashshell_5/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 15:55:53 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技巧]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/30/bashshell_5/</guid>
		<description><![CDATA[1.echo 参数，-n表示输出后不换行。 -e表示转化转义字符
2.
序列 	意义 
\a 	响铃。 
\b 	退格。
\c 	强制换行。
\e 	退出。
\f 	清除屏幕Form feed.
\n 	换行。
\r 	回车。
\t 	水平制表符。
\v 	垂直制表符。
\\ 	反斜杠。
\ONNN 	值为八进制值NNN（0到3个八进制数字）的8比特字符。
\NNN 	值为八进制值NNN（1到3个八进制数字）的8比特字符。
\xHH 	值为十六进制值（1或者2个十六进制数字）的8比特字符。
2.’-’ 可以表示程序需要从管道读取就可以达到目的
3.
分配给文件以文件描述符:
exec fdN&#62; file
分配文件描述符N给 file 进行输出：
exec fdN&#60; file
分配文件描述符N给 file 进行输入。
关闭文件描述符: exec fd&#60;&#38;-
4.here docment就像php的定界符

5.FILE == &#62;FILE 2&#62;&#38;1 把标准输出和标准错误重定向到FILE文件中.
6.for循环的结构语法
for NAME [in list];do commands;done
7.while循环的语法结构。
while control-command;do consequent-commands;done
8.until与while刚好相反当条件为真的时候退出。
until test-command;do consequent-commands;done
9.菜单生成与for的语法相似
select word [in list];do respective-commands;done
10.shift内建命令
其应用主要用于随过的参数输入的处理参数的遍历
shift后面跟 一个数字N做参数。原来的$1就变成$(N+1) $#变成$#-N+1
11.变量的定义
declare OPTION(s) VARIABLE=value
OPTION: -a 数组 -f [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/30/bashshell_5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(4)</title>
		<link>http://guogoul.com/2008/08/25/bashshell_4/</link>
		<comments>http://guogoul.com/2008/08/25/bashshell_4/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 14:51:13 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cut]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/25/bashshell_4/</guid>
		<description><![CDATA[1.if学习语法:if TEST-COMMANDS;then CONSEQUENT-COMMANDS;fi
test-commands表达式:



Primary
意义




[ -a FILE ]
                              
 如果 FILE 存在则为真。
                 [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/25/bashshell_4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(3)</title>
		<link>http://guogoul.com/2008/08/25/bashshell_3/</link>
		<comments>http://guogoul.com/2008/08/25/bashshell_3/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 00:08:47 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/25/bashshell_3/</guid>
		<description><![CDATA[1.算术操作符



操作符
意义




VAR++ and VAR&#8211;
变量自增和变量自减


++VAR and &#8211;VAR
变量前置加和前置减


- and +
一元减和加


! and ~
逻辑和按位取反


**
求幂


*, / and %
乘，除，求余


+ and -
加，减


&#60;&#60; and &#62;&#62;
左移和右移


&#60;=, &#62;=, &#60; and &#62;
比较操作符


== and !=
相等和不相等


&#38;
位与


^
位异或


&#124;
位或


&#38;&#38;
逻辑与


&#124;&#124;
逻辑或


expr ? expr : expr
条件赋值


=, *=, /=, %=, +=, -=, &#60;&#60;=, &#62;&#62;=, &#38;=, ^= and &#124;=
赋值


,
表达式间的分隔符



2.建立和移除别名aliasunalias,注意：别名不能被子进程继承
3.用set来设置选项显示所有的选项: set -o,注-号开启选项，+关闭选项例如： set -o noclobber: 文件不能被overwrite
4.touch用来建立一个空文件的好方法,touch主要用于改变文件改变的时间戳
5.grep: 以行为单位搜索那些包含给出模板列表的输入文件。当在一行中找到匹配，默认把行拷到标准输出grep中的正则: \&#60;表地单词的开始, \&#62;表示单词的结束grep -w匹配单词
6.字符族:使用语法:[:CLASS:]&#8220;alnum&#8221;,&#8221;alpha&#8221;,&#8221;ascii&#8221;,“blank”,&#8221;cntrl&#8221;,&#8221;digit&#8221;,&#8221;graph&#8221;,&#8221;lower&#8221;,&#8221;print&#8221;,&#8221;punct&#8221;,&#8221;space&#8221;,&#8221;upper&#8221;,&#8221;word&#8221;,&#8221;xdigit&#8221;
7.awk (分析的是每一行的输入)FS:域分割符代表内建的变量oRS:行分割符oFS:输出分割符=:赋值printf,print:输出BEGIN: 开始的定义以及输出处理END: 结束时的处理.
]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/25/bashshell_3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-基础(2)</title>
		<link>http://guogoul.com/2008/08/23/bashshell_2/</link>
		<comments>http://guogoul.com/2008/08/23/bashshell_2/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 15:21:30 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/23/bashshell_2/</guid>
		<description><![CDATA[1.注意：当运行脚本文件时,系统会建立一个子shell来运行文件中命令。函数和别名等只有子shell使用。当那个shell退出，父shell重新得到控制的时候，所有的东西都被清空，脚本对shell状态所作的改变耶全部清除。如果不想建在子shell中运行脚本可以直接： source script_name.sh这里脚本不需要可执行权限。命令在当前shell力执行，所以任何对环境的改变，将在脚本结束时同样起作用2.脚本选择:第一行决定了启动的shell，第一行的开始2个字符应该是#!，然后紧跟解释后面命令的shell的路径。空白行也被认为是一行，所以不要让你的脚本以空白行开始。
 #!/bin/bash3.注释:以#开头在一个良好的脚本中，第二行经常注明要完成的任务。然后为了明确每一大块命令将被加上注释。4.脚本调试调试参数:



短符号
长符号
结果




set -f
set -o noglob
禁止特殊字符用于文件名扩展。


set -v
set -o verbose
打印读入shell的输入行。


set -x
set -o xtrace
执行命令之前打印命令。



可以在文件里面直接定义#!/bin/bash -xv,或者在执行时候指定.bash -xv scripte_name.sh
5.一些环境中的特殊脚本文件.
/etc/profile:当用&#8211;login选项或者以SH来调用交互模式时，bash读取/etc/profile的指令。通常是一些设置shell变量PATH,USER,MAIL,HOSTNAME,HISTSIZE
/etc/bashrc: 由于其它的shell也有可会读出/etc/profile，这样的话把bash的脚本直接放到bashrc上更安全点.~/.bash_profile:个别的为用户配置环境。~/.bash_login: 只有在你登录进系统才执行的特殊的设置~/.profile: 没有~/.bash_profile和~/.bash_login文件的情况下被读取。~/.bashrc：在使用一个非登陆shell,比如使用x终端登录进图行模式。些时bash会搜索~/.bashrc.
~/.bash_logout: 登出系统时候的特别指令.
                        6.查看环境变量指令 printenv7.变量设置以及引用. MYVAR=&#8221;value&#8221; (指定变量MYVAR的值) echo $MYVAR（输出MYVAR这个变量的值）8.一个变量定义后仅仅在当前shell内产生，属于本地变量，子shell进程不会意识到这个的存在。为了把变量传递给子shell,需要用export命令输出出来.不过在子shell的改变对父shell没有影响.
9.保留变量



变量名字
定义




CDPATH
一个由冒号分割的目录列表作为内建命令 cd 的搜索路径。
     [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/23/bashshell_2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash编程学习-简单基础(1)</title>
		<link>http://guogoul.com/2008/08/22/bashshell_1/</link>
		<comments>http://guogoul.com/2008/08/22/bashshell_1/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 23:40:15 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/08/22/bashshell_1/</guid>
		<description><![CDATA[用linux环境也有快一年多的历史了，对于shell只是用到时候查一下文档，并没有系统化。接下来想抽时间系统的学习一下。先从简单开始吧。
1.查看系统中所有的shell
cat /etc/shells
2.查看用户的默认shell
 cat /etc/passwd
 3.切换shell
 直接输入shell名就可以。
 例如：mia:~&#62; tcsh
 [mia@post21 ~]$
4.当用户登录时机器自动运行的shell
 4.1/etc/profile
 4.2~/.bash_profile,~/.bash_login or~/.profile： 读取第一个存在的可读取的文件
 4.3 ~/.bash_logout 登出的时候。
 错误消息将会显示如果配置文件存在但是不能读取。一个文件不存在，Bash将搜索下一个。5,非登录应用一个非登陆shell就是不需要进行系统的认证。比如，通过一个图标打开一个终端，或者一个菜单项目，那样就是非登陆shell
 读取的文件：  ~/.bashrc
  此文件通常指向 ~/.bash_profile：if [ -f ~/.bashrc]; then . ~/.bashrc; fi 
7.远程调用 以 rshd 调用时读取的文件:~/.bashrc 
8.默认情况下历史命令和历史扩展式开启的。历史在shell退出时都保存在 HISTFILE 指向的文件中。默认情况下，HISTFILE 指向 ~/.bash_history
  9.wc统计文件的字数，与行数。
习题:(如果我做的不对，或者方法不佳请留言,还有一些没写答案，请高手支招)
  1.bash 程序位于你系统的什么位置？
  which bash
  2.使用 &#8211;version 选项来找到你正在运行的版本。
    [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/08/22/bashshell_1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
