Skip to content

Commit d294607

Browse files
committed
cheatsheet.sh: Make CWD independent
[why] Sometimes people like to call the scripts from any directory and do not want to change into the bin/scripts/ directory first. [how] Just access the lib files relative to the cheatsheet script file. Signed-off-by: Fini Jastrow <[email protected]>
1 parent e6bba1b commit d294607

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bin/scripts/cheatsheet.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# Search for a glyph by part of its name in all patchsets
66
# Usage: ./cheatsheet.sh divider
77

8+
# Get script directory to set source and target dirs relative to it
9+
sd="$( cd -- "$(dirname "${0}")" >/dev/null 2>&1 || exit ; pwd -P )"
10+
811
# shellcheck disable=SC1091 # Do not pull in the sourced file
9-
source ./lib/i_all.sh
12+
source "${sd}/lib/i_all.sh"
1013

1114
# Search the key on the declared variables
1215
for glyph in ${!i_*}; do

0 commit comments

Comments
 (0)