Reputation: 109
#!/bin/bash
export foo='script...'
bash --program=foo
how do you run the exported "foo"
i've been working with gtkdialog and it is written
#!/bin/bash
export MAIN_DIALOG='...xml code...'
gtkdialog --program=MAIN_DIALOG
the same should be possible with a simple bash script?
i would like this to reduce the number of files i must include
currently each set of bash scripts i write for one program are saved in separate files then executed by the main script.
Upvotes: 0
Views: 262
Reputation: 780974
To reduce the number of files, you can change the commands from separate scripts to functions in the main script:
cmd() {
# actions for foo command
}
Then, instead of using bash -c
to run them, you can use eval
:
foo='cmd ...'
eval "$foo"
Upvotes: 0