Revision 9312
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sh/util.sh | ||
---|---|---|
8 | 8 |
|
9 | 9 |
realpath() { readlink -f -- "$1"; } |
10 | 10 |
|
11 |
include_guard_var() { realpath "$1"|builtin command sed 's/[^a-zA-Z0-9_]/_/g'; }
|
|
11 |
str2varname() { builtin command sed 's/[^a-zA-Z0-9_]/_/g' <<<"$1"; }
|
|
12 | 12 |
|
13 |
include_guard_var() { str2varname "$(realpath "$1")"; } |
|
14 |
|
|
13 | 15 |
self_not_included() # usage: if self_not_included; then ... fi |
14 | 16 |
{ |
15 | 17 |
test $# -ge 1 || set -- "${BASH_SOURCE[1]}" |
Also available in: Unified diff
lib/sh/util.sh: added str2varname() and use it in include_guard_var()