![Bash 스크립트에서 Python 사전의 압축을 푸는 방법](https://linux55.com/image/209047/Bash%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EC%97%90%EC%84%9C%20Python%20%EC%82%AC%EC%A0%84%EC%9D%98%20%EC%95%95%EC%B6%95%EC%9D%84%20%ED%91%B8%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
내 Python 스크립트는 다음과 같이 사전을 bash 스크립트에 반환합니다.
dictionary=$(/path/to/my-script.py --my-profiles setenv)
my-script.py
def main():
parser = argparse.ArgumentParser(description='My script')
parser.add_argument('--my-profiles', dest="profiles",
type=str,
default='')
parsed_args = parser.parse_args()
if args.profiles == "setenv":
print({'SOME_ENV': '1', 'SOME_OTHER_ENV': '0'})
dictionary
Bash에 변수에 대한 사전이 있습니다 . 이 사전의 압축을 풀고 각 항목의 키와 값에 액세스하고 싶습니다.