I have a number of Bash and Perl scripts which are unrelated in functionality, but are related in that they work within the same project. The fact that they work in the same project means that I commonly specify the same directories, the same project specific commands, the same keywords at the top of every script.
Currently, this has not bitten me, but I understand that it would be easier to have all of these values in one place, then if something changes I can change a value once and have the various scripts pick up on those changes.
The question is - how is best to declare these values? A single Perl script that is 'required' in each script would require less changes to the Perl scripts, though doesn't provide a solution to the Bash script. A configuration file using a "key=value" format would perhaps be more universal, but requires each script to parse the configuration and has the potential to introduce issues. Is there a better alternative? Using environmental variables? Or a Bash specific way that Perl can easily execute and interpret?
key=value
format is native sh and can be sourced with the.
command. It can be easily parsed with perl. – Californiumexport
command. For example:export FOO=2
. – Plossleval
the results.ssh-agent
does this:eval ssh-agent -c
for c-shell,eval ssh-agent -s
for bourne shell. – Californium. SOURCE; echo \$var
– Clothespin