44 lines
855 B
Bash
Executable File
44 lines
855 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# functions to discover what directory this script is being executed from
|
|
get_abs_filename() {
|
|
# $1 : relative filename
|
|
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
|
}
|
|
|
|
get_script_dir() {
|
|
|
|
# call this with ${BASH_SOURCE[0]:-$0} as its (only) parameter
|
|
|
|
# set -x
|
|
|
|
local SCRIPT_PATH="$( get_abs_filename "$1" )";
|
|
|
|
pushd . > '/dev/null';
|
|
|
|
while [ -h "$SCRIPT_PATH" ];
|
|
do
|
|
cd "$( dirname -- "$SCRIPT_PATH"; )";
|
|
SCRIPT_PATH="$( readlink -f -- "$SCRIPT_PATH"; )";
|
|
done
|
|
|
|
cd "$( dirname -- "$SCRIPT_PATH"; )" > '/dev/null';
|
|
SCRIPT_PATH="$( pwd; )";
|
|
|
|
popd > '/dev/null';
|
|
|
|
# set +x
|
|
|
|
echo "${SCRIPT_PATH}"
|
|
}
|
|
|
|
SCRIPTDIR=$(get_script_dir "${BASH_SOURCE[0]:-$0}")
|
|
|
|
touch ~/.profile
|
|
cat >> ~/.profile <<EOF
|
|
PATH=\${PATH}:${SCRIPTDIR}
|
|
EOF
|
|
rm ${SCRIPTDIR}/medley_add2path.command
|
|
|
|
|