-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables
More file actions
37 lines (33 loc) · 1.26 KB
/
Copy pathvariables
File metadata and controls
37 lines (33 loc) · 1.26 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
#!/bin/bash
#
# Example for gl-common.bash
#
# CC0 - Public Domain, jeremy.walther@golflima.net
# To the extent possible under law, Jérémy Walther has waived
# all copyright and related or neighboring rights to this file.
# This work is published from: France.
# See: <https://creativecommons.org/publicdomain/zero/1.0/deed>
#
# Feel free to use it as you want.
#
# This example is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Load gl-common.bash
readonly EXAMPLE_DIR=$(dirname "$(echo "$(readlink -f "$0")" | sed -e 's,\\,/,g')")
. "${EXAMPLE_DIR}/../gl-common.sh" EXAMPLE_
if [[ $? > 0 ]]; then echo "Error when loading file '${EXAMPLE_DIR}/../gl-common.sh'"; exit 1; fi
set_var FOO BAR
set_var BAR ''
trace_var FOO
trace $(get_var FOO)
get_var FOO
echo
init_var LICENSE "spinner_green 'curl -sL https://www.gnu.org/licenses/lgpl-3.0.txt' | escape_piped"
grep GNU "${EXAMPLE_DIR}/../LICENSE" <<< "${LICENSE}" | echo_piped -e "Grepped GNU: "
is_set FOO && trace FOO is set
is_set BAR && trace BAR is set
is_set NOT_SET && trace NOT_SET is set
is_empty FOO && trace FOO is empty
is_empty BAR && trace BAR is empty
is_empty NOT_SET && trace NOT_SET is empty