-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddImg.sh
executable file
·70 lines (57 loc) · 991 Bytes
/
addImg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
scriptFolder=$(dirname $(readlink -f $0))
websiteFolder='./output'
sourceFile=''
getHelp() {
cat <<HELP
Commands related to this script
USAGE:
main.sh addImg [FLAGS] <srcFile>
srcFile designating a file.
FLAGS:
-h Print help informations.
--help Print help informations.
-s <directory> Sepcify the site folder.
--site=<directory> Sepcify the site folder.
HELP
return 1
}
main() {
while getopts ':hs:-:' option; do
case $option in
-)
case ${OPTARG} in
help)
getHelp
exit 0
;;
site=*)
websiteFolder=${OPTARG#*=}
;;
*)
echo "Invalid option --${OPTARG}\n">&2
getHelp>&2
exit 1
;;
esac;;
h)
getHelp
exit 0
;;
s)
websiteFolder=${OPTARG}
;;
\?)
echo "Invalid option -$option \n" >&2
getHelp >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
cd $websiteFolder
sourceFile=$1
cp ${sourceFile} ./static/img/
exit 0
}
main ${@}