I'm making this test script to help me reverse engineer scripts in charge of setting the dev environment.
#env-changes #!/bin/bash TESTED_SCRIPT=$1 shift ENV_BEFORE=$(env | sort) . $TESTED_SCRIPT ENV_AFTER=$(env | sort) diff <(printf '%s\n' "$ENV_BEFORE") <(printf '%s\n' "$ENV_AFTER")
Dummy env script:
#!/bin/bash export I_AM_NEW=hello
$ ./env-changes dummy-env-script.sh 21a22 > I_AM_NEW=hello
Currently it only works with
bash. Suggestions on how to make it more POSIX compilant?