#!/bin/sh script_path=$(readlink -f $0) dir_path=$(dirname $script_path) get_conf(){ while IFS= read -r line ; do cf_key=`echo $line | awk 'BEGIN {FS = "="} {print $1}'` cf_val=`echo $line | awk 'BEGIN {FS = "="} {print $2}'` eval $cf_key=$cf_val done < $1 } get_conf test.conf if [ "$1" ] then address=$1 fi if [ "$2" ] then username=$2 fi if [ "$3" ] then password=$3 fi