在shell中执行docker shell命令返回结果给变量。
test.sh
function test(){ result=(`bash -c "$1"`) echo ${result[0]} } test "docker exec -it airflow /bin/bash -c 'airflow list_dags'"
执行文件:
bash test.sh