Skip to content

Commit

Permalink
Add reference to bash-env to cookbook (#1434)
Browse files Browse the repository at this point in the history
* Add cookbook reference to bash-env plugin

* Also for ssh-agent

* Add note on unsupported nature of bash-env by core team.

* Warnings

* Oops, trailing colons
  • Loading branch information
tesujimath committed Jun 3, 2024
1 parent bcade24 commit 3a6deb1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cookbook/foreign_shell_scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ This quickly gets tricky though, for example when the script is declaring a
There are ways to implement some form of expansion too, but at some point it
might make more sense to leave the parsing to the shell it was meant for.

## Bash Env Plugin

There is a third-party Nu plugin [bash-env](https://github.com/tesujimath/nu_plugin_bash_env)
for importing environment variables from Bash format files and pipes.
This plugin uses Bash itself to parse the environment definitions,
and can therefore cope with arbitrarily complex Bash sources.

::: warning
Please note that the `bash-env` plugin is not supported by the core Nushell team.
All issues and requests for support should be directed to its own
[issue tracker](https://github.com/tesujimath/nu_plugin_bash_env/issues).
:::

## Capturing the environment from a foreign shell script

A more complex approach is to run the script in the shell it is written for and
Expand Down
12 changes: 12 additions & 0 deletions cookbook/ssh_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ Adding this to your `env.nu` will however start a new ssh-agent process every ti
See the workarounds.
:::

Alternatively, use the third-party Nu plugin [bash-env](https://github.com/tesujimath/nu_plugin_bash_env) as follows.

```nushell
^ssh-agent | bash-env | load-env
```

::: warning
Please note that the `bash-env` plugin is not supported by the core Nushell team.
All issues and requests for support should be directed to its own
[issue tracker](https://github.com/tesujimath/nu_plugin_bash_env/issues).
:::

## Workarounds

You can work around this behavior by checking if a ssh-agent is already running on your user, and start one if none is:
Expand Down

0 comments on commit 3a6deb1

Please sign in to comment.