Small corrections when exporting environment variables

This commit is contained in:
Héctor Molinero Fernández
2019-07-10 18:43:20 +02:00
parent 852fbcbeaf
commit 13687b9dfb

View File

@@ -1,12 +1,12 @@
#!/usr/bin/awk -f
BEGIN {
print("\n")
for (v in ENVIRON) {
if (v !~ /^(HOME|PWD|SHELL|USER|GROUP|UID|GID)$/) {
gsub(/[^0-9A-Za-z]/, "_", v)
gsub(/\n/, " ", ENVIRON[v])
if (v !~ /^(PWD|HOME|PATH|SHELL|HOSTNAME|UID|USER|GID|GROUP)$/) {
gsub(/[^0-9A-Za-z_]/, "_", v);
gsub(/'/, "'\\''", ENVIRON[v])
print "export '"v"="ENVIRON[v]"'"
print("export "v"='"ENVIRON[v]"'")
}
}
}