• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Bash script question, set working path

Red Squirrel

No Lifer
Seems I can't find anything on Google, maybe I'm not searching the right thing.

What I'm trying to do is write a bash script (part of a basic setup procedure for an app I wrote) and the user enters where they want the program installed. After it copies the files, it has to compile it, but I don't want to run the compile script in place as it will probably dump the exe in whatever folder the user is in. I want to execute the script from within it's own folder.

I tried using "cd [path]" within my script but it does not seem to work. Hard coding the path in the compile script is not an option, because it's unknown until the user enters it.

How do I go about doing this, I can't see it being very complicated, just can't seem to find anything.


edit: Nevermind! Turns out the cd method does work, it just happened the file I thought I was copying was not actually being copied so it never got executed.
 
Last edited:
For Linux apps, you should really be using native packages anyway. I loathe apps that don't use the local package manager and won't even consider an app that does that unless it's something that's light years ahead of the alternatives like VMware Workstation.
 
This is mostly just for me, but I may or may not release it to public. I just find it's easier to write my own basic install script. Just a tar.gz file and you run the setup.sh script. I guess the other ways have the advantage that it installs as a package and can be managed that way, uninstalled etc. One of these days I should probably learn to make rpms or even my own yum repository and yum packages then put all my custom stuff on there.
 
Back
Top