-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.sh
More file actions
executable file
·43 lines (34 loc) · 1.67 KB
/
local.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.67 KB
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
#!/bin/bash
# Check directory if not create
[ ! -d css ] && mkdir css
[ ! -d js ] && mkdir js
# Check css files if not download
[ ! -f css/black.css ] && wget https://unpkg.com/reveal.js@4.6.1/dist/theme/black.css -O css/black.css
[ ! -f css/reset.css ] && wget https://unpkg.com/reveal.js@^4.6.0//dist/reset.css -O css/reset.css
[ ! -f css/reveal.css ] && wget https://unpkg.com/reveal.js@^4.6.0//dist/reveal.css -O css/reveal.css
[ ! -f css/source-sans-pro.css ] && wget https://unpkg.com/reveal.js@4.6.1/dist/theme/fonts/source-sans-pro/source-sans-pro.css -O css/source-sans-pro.css
# Check js files if not download
[ ! -f js/search.js ] && wget https://unpkg.com/reveal.js@^4.6.0//plugin/search/search.js -O js/search.js
[ ! -f js/notes.js ] && wget https://unpkg.com/reveal.js@^4.6.0//plugin/notes/notes.js -O js/notes.js
[ ! -f js/reveal.js ] && wget https://unpkg.com/reveal.js@^4.6.0//dist/reveal.js -O js/reveal.js
[ ! -f js/zoom.js ] && wget https://unpkg.com/reveal.js@^4.6.0//plugin/zoom/zoom.js -O js/zoom.js
# Check Parameter Empty
[ -z "$1" ] && { echo -e "Some or all of the parameters are empty. \n\n Usage: $0 {{ name_of_file }}.md \n"; exit 1; }
# Check File exsists
[ ! -f "$1" ] && { echo "File $1 dose not exsist."; exit 1; }
# Check if .md extension
[ "${1: -5}" == ".html" ] || { echo "File is not a html file."; exit 1; }
# Array of file names
declare -a StringArray=("black.css" \
"source-sans-pro.css" \
"reset.css" \
"reveal.css" \
"search.js" \
"zoom.js" \
"notes.js" \
"reveal.js" \
)
for i in "${StringArray[@]}"; do
newname=$(echo "$i" | cut -d "." -f 2)/"$i"
sed -i "s|https.*$i|$newname|g" "$1"
done;