forked from veracruz-project/veracruz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_cli_test.sh
executable file
·36 lines (30 loc) · 988 Bytes
/
run_cli_test.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
#!/bin/bash
# AUTHORS
#
# The Veracruz Development Team.
#
# COPYRIGHT
#
# See the `LICENSE.markdown` file in the Veracruz root directory for licensing
# and copyright information.
#
# Runs the example in GETTING_STARTED_CLI.markdown as a bash script, with any
# failing commands results in an error
#
set -euo pipefail
# start from scratch
rm -f GETTING_STARTED_CLI.markdown.sh
# make it so any error results in script failure
echo 'set -euxo pipefail' >> GETTING_STARTED_CLI.markdown.sh
# grab every bash code block, remove line continuation, and only keep lines
# that start with '$' (of course removing that '$' in the process)
#
# GETTING_STARTED_CLI.markdown currently uses sgx, replace with requested TEE
#
sed -n '/``` bash/,/```/{/```/d; p}' GETTING_STARTED_CLI.markdown \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^\$/{s/^\$ \?//; p}' \
| sed "s/sgx/${1:-sgx}/g" \
>> GETTING_STARTED_CLI.markdown.sh
# run script
bash GETTING_STARTED_CLI.markdown.sh