摘要: 如何将shell script功能模块化,并且对外留出函数和参数接口。要写出这种高质量的模块化的东西,需要对要写的这一块的业务非常理解,知道哪些是通用的,哪些是不通用的。从而将其分离,废话不多说直接看一个我感觉很牛B的脚本。以下脚本的作用:我新写了一个内核device driver模块,下面的脚本是尝试将我的模块,加载模块,在/dev目录下创建结点+++删除文件,卸载模块。参数接口部分:#!/bin/bash# Sample init script for the a driver module <rubini@linux.it>DEVICE="scull"SE 阅读全文
posted @ 2011-11-01 17:26 Jack204 阅读(1706) 评论(0) 推荐(0) 编辑
摘要: Quoting a single character with the backslashYou can prevent the shell from interpreting a character by placing a backslash ("\") in front of it. Here is a shell script that can delete any files that contain an asterisk:echo This script removes all files thatecho contain an asterisk in the 阅读全文
posted @ 2011-11-01 14:35 Jack204 阅读(530) 评论(0) 推荐(0) 编辑