Skip to content

Instantly share code, notes, and snippets.

@Fishrock123
Last active January 6, 2025 20:22
Show Gist options
  • Save Fishrock123/c9274955cb0ead6a2d2c2b0717170e21 to your computer and use it in GitHub Desktop.
Save Fishrock123/c9274955cb0ead6a2d2c2b0717170e21 to your computer and use it in GitHub Desktop.
from_bash_env.nu
def from_bash_env []: string -> record { $in | str replace -amr '(&&)|(\r\n)|\n|;' "\n" | lines -s | str trim | parse --regex `export [\'\"]?(?<name>[^\'\"=]+)[\'\"]?=[\'\"]?(?<value>[^\'\"\n]+)[\"\']?` | transpose -ird }
# command | from_bash-env | load-env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment