跳转到主要内容

从文本文件创建环境变量

项目描述

安装

$ [sudo] pip install export-file

功能

  • 从文本文件创建环境变量 - 文件名作为变量名,内容作为值
  • 忽略不存在和空文件

用法

usage: export-file path ...

示例

$ export-file description.txt keywords.txt
export DESCRIPTION="@accepts decorator to check arguments types"
export KEYWORDS="type decorator"

$ eval <<< export-file description.txt keywords.txt
$ echo $DESCRIPTION
repo description

find 文件

$ IFS=;find="$(find -H . -type f -name "*.txt")"
$ [[ -n "$find ]] && { IFS=$'\n';set $find; eval "$(export-file "$@")"; }

由以下支持