Skip to content

Bash Shell

sipke edited this page Apr 24, 2024 · 3 revisions

https://stackoverflow.com/questions/4990575/need-bash-shell-script-for-reading-name-value-pairs-from-a-file

 read_properties()
 {
  file="$1"
  while IFS="=" read -r key value; do
    case "$key" in
      '#'*) ;;
      *)
        eval "$key=\"$value\""
    esac
  done < "$file"
 }
Clone this wiki locally