巴什:读取文本文件的VAR = VALUE格式变量 [英] Bash: Read Variables from Text-File VAR=VALUE Format
本文介绍了巴什:读取文本文件的VAR = VALUE格式变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从一个文本文件中的一些变量装入我的批处理脚本。
我试图寻找,但我只找到文件的提示,比如
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
和我希望能够加载该文件,以便我可以访问三个变量匹配它反对在bash的数字。
我怎样才能做到这一点?
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?
回答!谢谢!
推荐答案
保存变量文件像你想(VAR = VAL)并运行:
Save your variables to file like you want (VAR=VAL) and run:
. ./your_file
<击>也许有必须是#!/斌/庆典在这个文件的开头。击>假
这篇关于巴什:读取文本文件的VAR = VALUE格式变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文