diff --git a/bin/qfc.sh b/bin/qfc.sh index f6b361e..3632e2a 100755 --- a/bin/qfc.sh +++ b/bin/qfc.sh @@ -17,9 +17,18 @@ function get_cursor_position(){ echo "$row $col" } -if [[ -d ~/.qfc/ ]]; then - export PATH=~/.qfc/bin:"${PATH}" +if [[ -n "${BASH_SOURCE[0]}" ]]; then + QFC_DIR="$(dirname "${BASH_SOURCE[0]}")" +elif [[ -n $ZSH_VERSION ]]; then + QFC_DIR="$(dirname "${(%):-%N}")" +else + QFC_DIR=~/.qfc/bin fi +if [[ -x "$QFC_DIR/qfc" ]]; then + # export PATH="$QFC_DIR":"${PATH}" + alias qfc="$QFC_DIR/qfc" +fi +unset QFC_DIR if [[ -n "$ZSH_VERSION" ]]; then # zshell