[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Bash variables loaded from a seperate file

I have a number of scripts that all require the same configuration variables to be set.
I would like to load these from a seperate file that I can place comments in at the moment I am using eval thus

eval `cat script.conf`

where script.conf contains

variable1=value1
variable2=value2
...

but that will not allow comments in the script.conf file.

What I would like is a file like

#Variable1 sets blah
variable1=value1
#Variable2 sets blah
variable2=value2

0
birthstar
Asked:
birthstar
1 Solution
 
ravenplCommented:
use:
source script.conf
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now