load configuration from array and optional file

dev
Joe 3 years ago
parent a801fef36d
commit 9c8479bf45
Signed by: joe
GPG Key ID: 8595A3F8F2CE1B74
  1. 10
      ysm.sh

@ -12,6 +12,7 @@ default_action="increment"
default_path="$HOME/.ysess"
default_s_path="$HOME/.ysess/*.ysess"
declare -A config
config=(
[extension]="ysess"
[name]="last.$extension"
@ -21,6 +22,15 @@ config=(
[s_path]="$HOME/.ysess/*.ysess"
)
while read line
do
if echo $line | grep -F = &>/dev/null
then
varname=$(echo "$line" | cut -d '=' -f 1)
config[$varname]=$(echo "$line" | cut -d '=' -f 2-)
fi
done < ${config[path]}/ysm.conf
CreateFiles() {
if [ ! -d "$default_path" ]; then
mkdir $HOME/.ysess

Loading…
Cancel
Save