Skip to content

Commit

Permalink
~/bin directory to access scripts easily and keeping environment vari…
Browse files Browse the repository at this point in the history
…ables. (#49)

* keeping environment variables.

Useful way to keep the environment variables.

* Add a ~/bin directory to access scripts easily

Useful way to access yours scripts easily.
  • Loading branch information
joaofreires authored and Adnan Ahmed committed Apr 24, 2017
1 parent b648976 commit 32eabdc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,25 @@ function finish {
trap finish EXIT
```
## Saving your environment variables
When you do `export FOO = BAR`, your variable is only exported in this current shell and all its children, to persist in the future you can simply append in your `~/.bash_profile` file the command to export your variable
```bash
echo export FOO=BAR >> ~/.bash_profile
```
## Accessing your scripts
You can easily access your scripts by creating a bin folder in your home with `mkdir ~/bin`, now all the scripts you put in this folder you can access in any directory.
If you can not access, try append the code below in your `~/.bash_profile` file and after do `source ~/.bash_profile`.
```bash
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
```
# 4. Debugging
You can easily debug the bash script by passing different options to `bash` command. For example `-n` will not run commands and check for syntax errors only. `-v` echo commands before running them. `-x` echo commands after command-line processing.
Expand Down

0 comments on commit 32eabdc

Please sign in to comment.