-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparsemap
More file actions
executable file
·27 lines (25 loc) · 1023 Bytes
/
parsemap
File metadata and controls
executable file
·27 lines (25 loc) · 1023 Bytes
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
#!/bin/bash
# get_script_dir from stack overflow
# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
get_script_dir()
{
local SOURCE_PATH="${BASH_SOURCE[0]}"
local SYMLINK_DIR
local SCRIPT_DIR
# Resolve symlinks recursively
while [ -L "$SOURCE_PATH" ]; do
# Get symlink directory
SYMLINK_DIR="$( cd -P "$( dirname "$SOURCE_PATH" )" >/dev/null 2>&1 && pwd )"
# Resolve symlink target (relative or absolute)
SOURCE_PATH="$(readlink "$SOURCE_PATH")"
# Check if candidate path is relative or absolute
if [[ $SOURCE_PATH != /* ]]; then
# Candidate path is relative, resolve to full path
SOURCE_PATH=$SYMLINK_DIR/$SOURCE_PATH
fi
done
# Get final script directory path from fully resolved source path
SCRIPT_DIR="$(cd -P "$( dirname "$SOURCE_PATH" )" >/dev/null 2>&1 && pwd)"
echo "$SCRIPT_DIR"
}
php $(get_script_dir)/DotMapParser.php $@