#/bin/sh
# usage: ./ctsOpenClose.sh [path] (-o,-c)
# -o: Open cts
# -c: Close cts
# ps: This script only support two keywords
##### set the value you want here #####
keyword1="&2"
keyword2="HELLO"
filename="inpath.sh"
##### get path and parameter #####
path="./"
if [ $# -eq 0 ]
then
echo "Usage: $0 path paramater" >&2
exit 1
elif [ $# -eq 1 ]
then
para=$1
elif [ $# -eg 2 ]
then
path=$1
para=$2
fi
##### check parameter #####
case $para in
-o) echo "Open cts" ;;
-c) echo "Close cts" ;;
*) echo "Invalid parameter" >&2
exit 1
esac
##### main #####
files=`find $path -name $filename`
for file in $files
do
if [ $para == "-c" ]
then
./addComment.sh "$file" "$keyword1" "$keyword2"
else
./delComment.sh "$file" "$keyword1" "$keyword2"
fi
echo $file
done
exit 0
|