-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.bash
More file actions
39 lines (32 loc) · 825 Bytes
/
create.bash
File metadata and controls
39 lines (32 loc) · 825 Bytes
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
#!/bin/bash
# DELETE after script completion
echo "script incomplete, failing without action."
exit 0
# template path from repo home
template_path="lib/template.tex"
create_path=false
# any arguments provided?
if [ -z "$1" ]; then
echo "Usage failed: no arguments provided"
echo "Usage: bash create.bash <path> [--create-path=true|false]"
exit 1
fi
# more than one argument given, fail without action
if (( $# > 2 )); then
echo "Usage failed: more than two arguments given"
echo "Usage: bash create.bash <path> [--create-path=true|false]"
exit 1
fi
path="$1"
# parse flags
for arg in "$@"; do
case $arg in
--create-path=true)
create_path=true
;;
--create-path=false)
create_path=false
;;
esac
done
# we hope the given argument is a path