官术网_书友最值得收藏!

Including source files

In addition to functions, we can also create multiple scripts and include them such that we can utilize any shared variables of functions.

Let's say we have a library or utility script that contains a number of functions useful for creating files. This script by itself could be useful or reusable for a number of scripting tasks, so we make it program neutral. Then, we have another script, but this one is dedicated to a single task: performing useless file system operations (IO). In this case, we would have two files:

  1. io_maker.sh (which includes library.sh and uses library.sh functions)
  2. library.sh (which contains declared functions, but does not execute them)

The io_maker.sh script simply imports or includes the library.sh script and inherits knowledge of any global variables, functions, and other inclusions. In this manner, io_maker.sh effectively thinks that these other available functions are its own and can execute them as if they were contained within it.

主站蜘蛛池模板: 巴彦淖尔市| 孟村| 平南县| 彰化县| 黎平县| 乌兰浩特市| 抚远县| 宣城市| 如皋市| 灵丘县| 新乡市| 建昌县| 乐山市| 石家庄市| 长沙市| 台湾省| 清流县| 花莲县| 郎溪县| 兴业县| 顺昌县| 宝丰县| 潮安县| 临潭县| 太仓市| 登封市| 双牌县| 色达县| 织金县| 祥云县| 福海县| 朔州市| 夏河县| 大足县| 房产| 湘潭县| 常熟市| 长春市| 昔阳县| 察哈| 灌阳县|