﻿<?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>Gavin&#039;s Blog &#187; Bourne Shell</title>
	<atom:link href="http://laigw.name/tag/bourne-shell/feed" rel="self" type="application/rss+xml" />
	<link>http://laigw.name</link>
	<description>Keep it simple, stupid. Simplicity is beauty.</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:14:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bourne Shell及shell编程</title>
		<link>http://laigw.name/post/76.html</link>
		<comments>http://laigw.name/post/76.html#comments</comments>
		<pubDate>Sat, 15 Nov 2008 07:55:19 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Bourne Shell]]></category>
		<category><![CDATA[Shell编程]]></category>

		<guid isPermaLink="false">http://www.laigw.name/?p=76</guid>
		<description><![CDATA[来源：http://www.wanglimin.com/Tutorial/HP-UNIX/DOCS/shell01.htm
介绍：Bourne Shell 基础及其他很多有用的特性，shell编程及组织。 
主要内容：
.shell基础 基本介绍，环境，选项，特殊字符
.shell变量 用户定义变量，环境变量，位置变量(shell 参数)
.shell script编程
条件测试，循环及重复控制
.shell定制

1.shell基础知识
作者：Stephen Bourne 在Bell实验室开发
建议：man sh 查看相关UNIX上的改进或特性 
(1)shell提示符及其环境
/etc/passwd文件
提示符：$
/etc/profile $HOME/.profile
(2)shell执行选项
-n 测试shell script语法结构，只读取shell script但不执行
-x 进入跟踪方式，显示所执行的每一条命令，用于调度
-a Tag all variables for export
-c &#8220;string&#8221; 从strings中读取命令
-e 非交互方式
-f 关闭shell文件名产生功能
-h locate and remember functions as defind
-i 交互方式
-k 从环境变量中读取命令的参数
-r 限制方式
-s 从标准输入读取命令
-t 执行命令后退出(shell exits)
-u 在替换中如使用未定义变量为错误
-v verbose,显示shell输入行 
这些选项可以联合使用，但有些显然相互冲突，如-e和-i. 
(3)受限制shell(Restircted Shell)
sh -r 或 /bin/rsh 
不能执行如下操作：cd, 更改PATH,指定全路径名，输出重定向，因此可以提供一个较
好的控制和安全机制。通常rsh用于应用型用户及拨号用户，这些用户通常是看不到提
示符的。通常受限制用户的主目录是不可写的。 
不足：如果用户可以调用sh,则rsh的限制将不在起作用，事实上如果用户在vi及more
程序中调用shell,而这时rsh的限制将不再起作用。 
(4)用set改变 shell选项
用户可以在$提示符下用set命令来设置或取消shell的选项。使用-设置选项，+取消相应
选项，大多数UNIX系统允许a,e,f,h,k,n,u,v和x的开关设置/取消。 
set -xv
启动跟踪方式;显示所有的命令及替换，同样显示输入。
set -tu
关闭在替换时对未定义变量的检查。 [...]]]></description>
		<wfw:commentRss>http://laigw.name/post/76.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

