# Shell

# Bash



# Export Variables From a File

If you store environment variables in a file and want to quickly export all of them it is actually not as simple as running an `export` on each line.

```bash
# source $MY_FILE
# export $(cut -d= -f1 $MY_FILE)
```
[source](https://unix.stackexchange.com/questions/79064/how-to-export-variables-from-a-file)

Another thing you can do is update `~/.bashrc` or equivalent files for other shells and add a method to do this for you since those commands aren't easy to remember.

```diff
# ~/.bashrc
+ # exports variables stored in a file
+ function export_file() {
+   source $1
+   export $(cut -d= -f1 $1)
+ }
```

# Fish



# Add Custom User Path

You can use the `set` command to prepend a new path to your `$PATH`.

```sh
set -U fish_user_paths $HOME/.cargo/bin $fish_user_paths
```

<p class="callout info">`-U  or --universal causes the specified shell variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current user's fish instances on the current computer, and will be preserved across restarts of the shell.`</p>