Results 1 to 1 of 1
I have some text files which contains the list of file names like this:
common_zip
Code:
Makefile
README
cxx_win_zip:
Code:
bin/hello.exe
bin/hello.dll
cxx_unx_zip:
Code:
bin/hello
lib/hello.so
All these files are ...
- 10-31-2008 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 59
Shell script: is this a good script?
I have some text files which contains the list of file names like this:
common_zip
cxx_win_zip:Code:Makefile README
cxx_unx_zip:Code:bin/hello.exe bin/hello.dll
All these files are present at $BUILD_ROOT location.Code:bin/hello lib/hello.so
I want to write a script which will create zips of these files. for ex,
If I run the script on windows, it should create these 2 zips:
common.zip (contains Makefile, README)
cxx.zip (contains bin/hello.exe, bin/hello.dll)
and on non-windows machine, the script should create these 2 zips:
common.zip (contains Makefile, README)
cxx.zip (contains bin/hello, lib/hello.so)
This is my script:
Is this a good script? Can a implement it in a better way?Code:Common_Comp="common" Win="cxx" Unx="cxx" make_zip(){ zip $1 `cat $2` } cd $BUILD_ROOT case `uname` in Windows_NT) for i in ${Win}; do make_zip $i.zip ${i}_win_zip done ;; Linux) for i in ${Unx}; do make_zip $i.zip ${i}_Unx_zip done ;; esac for i in $Common_Comp $Win $Unx do if [ ! -f $i.zip ] then make_zip $i.zip ${i}_zip fi done


Reply With Quote