-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashog
executable file
·34 lines (29 loc) · 906 Bytes
/
bashog
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
#!/usr/bin/env bash
# This function tries to retrieve the current script directory.
# Case this script is a symlink, it will try to resolve it. If
# the script is a relative symlink it will resolve it relative
# to the symlink base directory.
# USAGE: bashog.get_current_script_dir
# RETURN: string
function bashog.get_current_script_dir()
{
local src="${BASH_SOURCE[0]}"
local dir
# While $src is a symlink, resolve it
while [ -h "$src" ]; do
dir="$( cd -P "$( dirname "$src" )" && pwd )"
src="$( readlink "$src" )"
# relative symlink
[[ $src != /* ]] && src="$dir/$src"
done
dir="$( cd -P "$( dirname "$src" )" && pwd )"
echo "$dir"
}
curr_script_dir="$(bashog.get_current_script_dir)"
cat "${curr_script_dir}/.logo"
source "${curr_script_dir}/lib/functions.sh"
feed="$(pwd)/feed.hog"
if [ ! -f "$feed" ]; then
bashog.print_error "feed.hog file not found."
fi
bashog.run "$feed"