From 7118b2a9b02f734e65f788764373c8e8986059a0 Mon Sep 17 00:00:00 2001 From: Mathieu Loiseau <mlois_-gr@yahoo.fr> Date: Sat, 18 Apr 2015 16:25:16 +0200 Subject: [PATCH] no more need to indicate script location in alias or anywhere --- config.sh | 4 +--- game.sh | 4 +++- readme.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config.sh b/config.sh index 79106bc..ddb5187 100755 --- a/config.sh +++ b/config.sh @@ -1,4 +1,2 @@ #!/bin/bash -#configure working directories -export workingDirectory="/where/gamepad-switcher/is" -export killProcessesScript="a/shell/file/that/will/be/created/and/erased/in/working/directory" \ No newline at end of file +export killProcessesScript="killControllers.sh" \ No newline at end of file diff --git a/game.sh b/game.sh index 4f75039..439bffe 100755 --- a/game.sh +++ b/game.sh @@ -4,8 +4,10 @@ # 2 → name of the game as suggested in menu #configuration -. ./config.sh +export workingDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" +#(thanks http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in) cd $workingDirectory +. ./config.sh if [ -e "$killProcessesScript" ] then echo "There seems to be (a) running instance(s) of the game controller, do you want to brutally kill the processes? (Y/n)\nI'm not sure what it does if you don't…" diff --git a/readme.txt b/readme.txt index ea22ae7..ebe5247 100644 --- a/readme.txt +++ b/readme.txt @@ -2,4 +2,4 @@ This is a gamepad module switching script intended for use with the Microsoft Xb To permanently add an alias add the following line to ~/.bash_aliases (if the file does not exist, simply create one) and substitute the name and path as necessary: -alias <name_of_alias>="cd /path/to/this/folder && ./game.sh && cd -" +alias <name_of_alias>="/path/to/this/folder/game.sh" -- GitLab