Any tool to produce a "static" executable starting from a bash script and some config files?
by joenew from LinuxQuestions.org on (#4V6JP)
I'm wondering if there is a way to merge a bash script with one or more of its input files to obtain a new executable file, so that you have not need to keep the above input files, let's look at them as config files for instance..
Example:
Code:#!/bin/bash
VAR1=very_long_file_1.txt
VAR2=very_long_file_2.xml
do some stuff with $VAR1 and $VAR2Ok, it actually works only if files 1 and 2 are in the current directory.
How can I make it work even if no one of thoose files exist? As a stand alone
I could embed them within the script code by for istance an "here document", but I don't like that solution due to the size of thoose files: if they are really long, my script code become hard to navigate and review.
Is there an other way to keep bash code separed from the input files, but at the same time create a stand alone "executable"?
I mean something produced as follows:
Code:mkdir workdir
cd workdir
vi myscript.sh
cp /path/to/file1 .
cp /path/to/file2 .
unkonwn_command . -o executable.out
---> executable "executable.out" createdThat executable should be working even if it is used in any other file system directory, because with our "unknown_command" the two needed files are "statically linked" to the executable .out file.
It could be not so clear, I know... anyway I tried.
Do you know any tool to achieve that?
Any idea?
Thanks in advance!
Bye! :)


Example:
Code:#!/bin/bash
VAR1=very_long_file_1.txt
VAR2=very_long_file_2.xml
do some stuff with $VAR1 and $VAR2Ok, it actually works only if files 1 and 2 are in the current directory.
How can I make it work even if no one of thoose files exist? As a stand alone
I could embed them within the script code by for istance an "here document", but I don't like that solution due to the size of thoose files: if they are really long, my script code become hard to navigate and review.
Is there an other way to keep bash code separed from the input files, but at the same time create a stand alone "executable"?
I mean something produced as follows:
Code:mkdir workdir
cd workdir
vi myscript.sh
cp /path/to/file1 .
cp /path/to/file2 .
unkonwn_command . -o executable.out
---> executable "executable.out" createdThat executable should be working even if it is used in any other file system directory, because with our "unknown_command" the two needed files are "statically linked" to the executable .out file.
It could be not so clear, I know... anyway I tried.
Do you know any tool to achieve that?
Any idea?
Thanks in advance!
Bye! :)