Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有一个文件如下所示:
abc def ghi
现在,我想使用一个 Linux shell 脚本来根据这个文件设置一些变量。我需要设置以下变量,例如:
export abc=abc111 export def=def111 export ghi=ghi111
如您所见,变量名称也是从列表文件中检索的。谢谢。
while read var; do export $var=${var}111 done < vars.txt