Tuesday, November 13, 2007

script - create package

Today I write a shell script that is used to create project package, so I can backup easily. There are two features I want the script supports, one is have a date stamp automatically generated, second in the source code directory I want to filter only c source code, for instance just have c and h file.

Here is the script:

export PROJECT_NAME=foo
export PROJECT_PATH=/devel/project
export PROJECT_SRC_PATH=$PROJECT_PATH/src
export DATESTAMP=`date +%d%b%Y`

cd $PROJECT_SRC_PATH
tar czf $PROJECT_NAME-$DATESTAMP.tar.gz ./Makefile.arm-linux ./plugin/*.[ch] ./application/*.c

echo "DONE!"