Skip to content

Instantly share code, notes, and snippets.

@gmariette
Created February 26, 2020 08:15
Show Gist options
  • Select an option

  • Save gmariette/792001e981b865a22809c09a2eb91b07 to your computer and use it in GitHub Desktop.

Select an option

Save gmariette/792001e981b865a22809c09a2eb91b07 to your computer and use it in GitHub Desktop.
dumpedInstancesByEnv = json.dumps(instancesByEnv, indent=4)
f=open("/home/youruser/env_status.json", "w+")
f.write(dumpedInstancesByEnv)
f.close()
bashprofile = open("/home/youruser/.bash_profile", "a+")
bashprofileLines = bashprofile.readlines()
for line in bashprofileLines:
if "env_status.json" in line:
print("bash_profile already sourcing env_status.json")
found = True
else:
found = False
if not found:
bashprofile.write('cat /home/youruser/env_status.json \n')
bashprofile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment