2012年2月22日

bash 学习笔记4

摘要: 文件的读取: 可以通过descriptor来进行读取 如:exec 3<orders.txtexec 4>log.outwhile read LINE <&3 ; doprintf “%s\n” “$LINE” >&4done descriptor从3开始,0是标准输入,1是标注输出,2是标准错误输出。 descriptor的位置可以在/dev/fd中搞到。 当然也可以通过如下方式来读取文件:while read LINE ; doprintf “%s\n” “$LINE” >&4done<log.out cut的用法: cut -d 阅读全文

posted @ 2012-02-22 14:57 萌@宇 阅读(169) 评论(0) 推荐(0) 编辑

bash 学习笔记3

摘要: shell 脚本之间的同步: java中的同步比较简单,无外乎就是synchronize,lock,读写锁,condition之类的。shell脚本之间通过创建lock文件来同步。 如:declare -r INVOICES_LOCKFILE=”/var/lock/invoices_lock”while test ! -f “$INVOICES_LOCKFILE” ; doprintf “Waiting for invoices to be printed...\n”sleep 10donetouch “$INVOICES_LOCKFILE” 检查lock文件,如果不存在就生成loc... 阅读全文

posted @ 2012-02-22 14:15 萌@宇 阅读(134) 评论(0) 推荐(0) 编辑

bash 学习笔记2

摘要: 大文件切分:fedoraspilt -b 10m sourceFile desPrefix小文件合并:cat sourceFile1 sourceFile2 ....>destFile 阅读全文

posted @ 2012-02-22 13:49 萌@宇 阅读(131) 评论(0) 推荐(0) 编辑

导航