问题
I want to load some variable from a text file into my batch script. I tried searching but I only find tips for files like
VALUE1
VALUE2
...
My TEXT-File has the following format:
VER=123
MIN_VER=123456789
TARGET_VER=132456790
And I want to be able to load this file so that I can access the three variables for matching it against a number in bash. How can I achieve this?
Answered! Thanks!
回答1:
Save your variables to file like you want (VAR=VAL) and run:
. ./your_file
Maybe there will have to be"#!/bin/bash" at the beginning of this file. False
来源:https://stackoverflow.com/questions/11603349/bash-read-variables-from-text-file-var-value-format