<?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; backup</title>
	<atom:link href="http://guogoul.com/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://guogoul.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Oct 2010 00:24:37 +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编程学习-基础(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>
	</channel>
</rss>

