https://github.com/caijinglong/find_env_shell
Configure different environment for each project.
https://github.com/caijinglong/find_env_shell
bash environment zsh
Last synced: 8 months ago
JSON representation
Configure different environment for each project.
- Host: GitHub
- URL: https://github.com/caijinglong/find_env_shell
- Owner: CaiJingLong
- License: mit
- Created: 2020-04-18T03:38:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-20T05:58:19.000Z (over 1 year ago)
- Last Synced: 2025-04-22T14:11:38.905Z (about 1 year ago)
- Topics: bash, environment, zsh
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# find_env_shell
Quickly insert some environment variables in the command line by .env file.
Support macOS.
Linux should also support.
[中文文档](./README_CN.md)
## Usage
### Bash
download `find_env.sh`, and insert next code to your `~/.bash_profile`
```bash
source ~/Downloads/find_env.sh # your file path
```
It is best to stay on the last line.
### Zsh
download `find_env.zsh`, and insert next code to your `~/.zshrc`
```bash
source ~/Downloads/find_env.zsh # your file path
```
It is best to stay on the last line.
## Zsh Example
```zsh
cd /tmp
git clone https://github.com/caijinglong/find_env_shell.git
cd find_env_shell
cat 'source /tmp/find_env_shell/find_env.zsh' >> ~/.zshrc
cd sub1
source ~/.zshrc
```
then, The zsh will output next:
```zsh
find .env file in /tmp/find_env_shell/sub1
find .env file in /tmp/find_env_shell
source /tmp/find_env_shell/.env
shell.env # the log come from .env of project root path.
source /tmp/find_env_shell/sub1/.env
sub1 # the log come from sub1/.env
```
## Add file to config file
Download `find_env.zsh` or `find_env.sh`
zsh:
```shell
mkdir ~/shells
curl https://raw.githubusercontent.com/CaiJingLong/find_env_shell/master/find_env.zsh > ~/shells/find_env.zsh
echo "source ~/shells/find_env.zsh" >> ~/.zshrc
source ~/.zshrc
```
sh or bash
```shell
mkdir ~/shells
curl https://raw.githubusercontent.com/CaiJingLong/find_env_shell/master/find_env.sh > ~/shells/find_env.sh
echo "source ~/shells/find_env.sh" >> ~/.bash_profile
source ~/.bash_profile
```
If you use the method to add env to your shell, when you change your `.env` file, you just run `find_env` in your shell to refresh environment.
## License
MIT Style