When trying to execute a bash script, it is often execute inside some directory, and requires access to local resources. I was wondering if there was a way to combine both the bash script and the resources (everything else in the directory) into an executable, so that I would only need that executable stand-alone to execute the bash script.
shar(1)
would be traditional, but why does it need to be a single executable, when you could instead usersync
orgit
or something to move a file tree around as needed?pwd
command? Also, you can store the name of the directory containing the resources your script needs in a variable in the script, or pass it in on the command-line.home=$(dirname $(readlink -e $0))
, but hopefully you shouldn't need to do that.