-
Notifications
You must be signed in to change notification settings - Fork 0
/
btscurl.sh
executable file
·55 lines (51 loc) · 1.18 KB
/
btscurl.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
#!/bin/bash
outfile="container"
url=""
quickUrl=""
route=0
parse_args() {
case "$1" in
-o)
outfile="$2"
;;
-u)
url="$2"
;;
-qu)
if [ $2 = "container" ]
then
quickUrl="https://raw.githubusercontent.com/BenTStark/toolbox/master/react_container/"
fi
;;
*)
echo "Unkown or badly placed parameter '$1'." 1>&2
exit 1
;;
esac
}
while [ "$#" -ge 2 ]
do
parse_args "$1" "$2"
shift; shift
done
if [ -z "$url" ] && [ -z "$quickUrl" ]
then
echo "URL missing!"
exit 1
fi
if [ $route = 1 ]
then
echo "vollständige URL angegeben"
curl "$url" -o "$outfile.jsx"
else
echo "Schnellzugriff:"
curl "$quickUrl/container.jsx" -o "$outfile.jsx"
sed -i "s/<Container>/${outfile^}/g" "$outfile.jsx"
sed -i "s/<container>/$outfile/g" "$outfile.jsx"
curl "$quickUrl/container.view.jsx" -o "$outfile.view.jsx"
sed -i "s/<Container>/${outfile^}/g" "$outfile.view.jsx"
sed -i "s/<container>/$outfile/g" "$outfile.view.jsx"
curl "$quickUrl/container.test.jsx" -o "$outfile.test.jsx"
sed -i "s/<Container>/${outfile^}/g" "$outfile.test.jsx"
sed -i "s/<container>/$outfile/g" "$outfile.test.jsx"
fi