代码: 全选
#!/bin/bash
sum=0 ;
for fl in $(find ./ -name "*.cpp" -o -name "*.h") ;
do
l=$(wc -l $fl | awk '{print $1;}' ) ;
(( sum+=$l));
done;
echo $sum;
代码: 全选
#!/bin/bash
if [[ $# -eq 0 || $# > 2 ]] ; then
echo "usage mksc [type] filename"
exit
fi
tp=""
fl=""
if [ $# == 1 ] ; then
fl=$1
else
fl=$2
case $1 in
sh)
tp="#!/bin/sh"
;;
bash)
tp="#!/bin/bash"
;;
tcl)
tp="#!/usr/bin/tclsh"
;;
tk)
tp="#!/usr/bin/wish"
;;
esac
fi
touch $fl
chmod ug+x $fl
echo $tp >> $fl
vim $fl