在bash中可以使用
export
printenv
JQ 会为您完成此操作,并用结果填充名为
ENV
var=$(jq -n '$ENV')
要从列表中删除
_
SHLVL
del
var=$(jq -n '$ENV | del(._, .SHLVL)')