In my project, several paths to various directories, files and other components of the system are stored as #define in filenames.h , a file that contains everything you need. It works well for all binaries generated by compilation, but the project also includes several shell scripts that use the same paths. Currently, this means that as the path changes, all I have to do is edit filenames.h and recompile to get a set of executables to understand the new path, but I need to manually edit each shell script.
So, the question is how to make #defines in shell variables, for example, generate several filenames.sh scripts that will be called from other scripts to initialize them. For example:
#define TMP_PATH "/ait/tmp/" #define SYNCTMZFILE TMP_PATH "sync_tmz"
will create
TMP_PATH="/ait/tmp/" SYNCTMZFILE="/ait/tmp/sync_tmz"
Of course, you could write a C program that created it (even prints it to stdout and then runs it in the opposite direction in the shell), but I would prefer a simpler, more reliable method, say, they write half-shell halfway, like , for example, through cpp , will create the correct output or something like that.
source share