一個好玩的Linux shell指令碼,基本思路是迴圈調用cowsay
效果如下
------------------------------------------------------------------------華麗麗的分割線------------------------------------------------------------------------------
(部分圖片)
------------------------------------------------------------------------華麗麗的分割線------------------------------------------------------------------------------
關鍵代碼如下
########################################################################## File Name: mycowsay.sh# Author: huangjinqiang# Email: ligelaige@gmail.com# Created Time: 2014年04月28日 星期一 18時41分33秒##########################################################################!/bin/bashCMD=cowsay$CMD "Hello, Jinqiang!"if [ $? -ne 0 ];then echo "please enter following command to install" echo "sudo apt-get install $CMD" echo "or" echo "sudo aptitude install $CMD" exitfidir=/usr/share/cowsay/cows/for filename in `ls $dir`do if [ $# -eq 0 ];then read key fi if [ "$key" = "" ];then key="Hello, Jinqiang!" fi name=${filename%".cow"} $CMD -f $name $keydone
代碼下載:http://pan.baidu.com/s/1eQ9pKzC