0

I have a bash script that uses ADB to install a couple apps. The apps are kept in a folder and are referenced as ./apps/1.apk. When executed from the terminal, this script acts as intended. It can locate the apk files and install them.

When double clicked through a file manager, the script acts differently. I get an error message telling me it "cannot find location" of ./apps/1.apk. Why doesn't the executable recognize it's current directory when double clicked?

I need this to work as I've built this script for people I work with who are unfamiliar with the Terminal.

Below is the script. It is not that complex at all. Currently running with all permissions granted.

#!/bin/bash
adb install ./apps/1.apk
adb install ./apps/2.apk
jagdpanzer
  • 693
  • 2
  • 10
  • 35
  • Did you add `echo` statements to see what the current directory is when launched by double-click? – Jonny Henly Aug 17 '16 at 17:36
  • @JonnyHenly Took your suggestion and did that, interesting results: It seems that the script executes in my default working directory, even though it is run from the folder containing the script. How do I rectify this? – jagdpanzer Aug 17 '16 at 17:44

0 Answers0