-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_scriptinfo.sh
More file actions
52 lines (48 loc) · 1.44 KB
/
lib_scriptinfo.sh
File metadata and controls
52 lines (48 loc) · 1.44 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# ==============================================================================
###
### # lib_scriptinfo.sh
###
### Include for script information functions.
###
### **Usage**:
###
### ```bash
### MY_PATH="$(realpath "${BASH_SOURCE[0]}")"
### SCRIPT_DIR="$(dirname "${MY_PATH}")"
### readonly MY_PATH
### readonly SCRIPT_DIR
### readonly LIB_BASH_DIR="${SCRIPT_DIR}/lib_bash"
### source "${LIB_BASH_DIR}/lib_scriptinfo.sh"
### ```
###
# ==============================================================================
# Guard variable to prevent multiple imports
if [[ -n "${LIB_SCRIPTINFO_SH_INCLUDED:-}" ]]; then
return
fi
LIB_SCRIPTINFO_SH_INCLUDED=1
LIB_SCRIPTINFO_PATH="$(realpath "${BASH_SOURCE[0]}")"
readonly LIB_SCRIPTINFO_PATH
LIB_SCRIPTINFO_DIR="$(dirname "${LIB_SCRIPTINFO_PATH}")"
readonly LIB_SCRIPTINFO_DIR
# shellcheck source=/dev/null
source "${LIB_SCRIPTINFO_DIR}/lib_init.sh"
# ------------------------------------------------------------------------------
###
### ## Functions
###
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
###
### ### get_script_name
###
### Get script name (without path, with extension).
###
### * **Arguments**: _None_
### * **Returns**: The script name.
###
# ------------------------------------------------------------------------------
function get_script_name() {
echo "${0##*/}"
}