Loading variables from a file to a bash script

Elegant

I’m just copying the idea from this answer in StackExchange because it looks to me as an elegant way to solve this question.

I have a file like this:
# Kernel
loggerlevel=0
fromlogfile=1
variables=100
period=60

Filled with variables and their values.

Next the script to process and use those variables:

#!/bin/bash

source kernel

echo $loggerlevel
echo $fromlogfile
echo $variables
echo $period

After sourcing it, we get :

. process.sh 

0
1
100
60

Easy, peasy!