天天看点

读书笔记--101个shell脚本 之#12--函数

今天这个脚本其实很简单,但很实用,讲的是shell中函数的应用

To turn the functions in this chapter into a library for use in other scripts, extract all the functions and concatenate them into one big file. If we call this file library.sh, a test script that accesses all of the functions might look like this:

应用函数,我们就可以复用我们的脚本。

值得注意的是 $ . <b>tinyscript.sh  ,就是在当前shell下执行脚本,不加"."或source</b>

<b>则会在子shell下执行脚本,可能会有不同的情况发生,值得注意。</b>

<b></b>

<b>      本文转自hb_fukua  51CTO博客,原文链接:</b><b>http://blog.51cto.com/2804976/597476</b><b>,如需转载请自行联系原作者</b>