-
Notifications
You must be signed in to change notification settings - Fork 0
/
cumsum
executable file
·21 lines (16 loc) · 895 Bytes
/
cumsum
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
if [ "$#" -ne 1 ]; then # check if there is 1 argument
echo "Usage: $0 <folder>" >&2
exit 1 # if not exit program
fi
folder=$1
if [[ "${folder:0-1}" =~ '/'$ ]] ; then # check if last char is '/'
folder=${folder%?} # remove last char
fi
if [ -f $folder".zip" ]; then # check if ***.zip already exist
echo -e "deleting $folder.zip ...\n"
rm "$folder.zip" # delete if already exists
fi
echo "creating $folder.zip..."
zip -r "$folder.zip" $folder team.txt -x "$folder/readme.md" # creat zip without readme.md and team.txt
exit 1