timberline-secondary / hackerspace-scripts

Scripts for managing the Hackerspace's network
1 stars 2 forks source link

control-panel issue #25

Closed PederSkaaravik closed 7 years ago

PederSkaaravik commented 7 years ago

now that we are able to execute "control-panel" anywhere, wherever you execute the script, will be the directory the panel lists. due to the programs working directory being the string of "pwd". if i cd into lets say, my pictures, and run the panel, it will list the pictures because thats what it knows.

comment some suggestions maybe? what im thinking is maybe have a prompt something like "insert script directory" ?

tylerecouture commented 7 years ago

You can detect the directory of control panel from within itself, then just CD there.

Cant get link from my phone but search "how to detect scripts own directory" and several stack overflow examples for bash come up.

tylerecouture commented 7 years ago

Also, you shouldn't push code to the master if you know it's buggy! The master code should ALWAYS be tested and working. If it doesn't work, then we need to revert the commits that break it.

tylerecouture commented 7 years ago

As for this bug, you probably want something like this at the top:

this_script_dir=dirname "$(readlink -f "$0")"
cd $this_script_dir

https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within