Download this code from https://codegive.com
Title: Integrating Environment Variables in macOS Yosemite for Bash and Python in Sublime Text 2
Introduction:
MacOS Yosemite introduced several changes and improvements to the operating system, including updates to the Bash shell. Understanding how environment variables work in the Bash shell and Python interpreter can be crucial for efficient development. In this tutorial, we will explore how to set and use environment variables in macOS Yosemite, execute scripts in the Terminal, and troubleshoot issues that may arise when running scripts in the Sublime Text 2 text editor.
Open Terminal:
Edit Bash Profile:
Add Environment Variable:
Save and Exit:
Now, let's create a simple Bash script that uses the environment variable:
Save the script, make it executable with chmod +x script.sh, and execute it in the Terminal with ./script.sh. You should see "Hello, World!" printed on the screen.
Install Sublime Text 2:
Install Package Control:
Install SublimeREPL:
Configure Build System:
Configure Build System for Python:
Run Python Script:
Ensure SublimeREPL Path:
Check Sublime Console:
Verify Environment Variable:
By following these steps, you should be able to seamlessly use environment variables in both the Terminal and Sublime Text 2 for Bash and Python scripts.
ChatGPT