This is a personal cheatsheet to help me when I forget things.
Printing env vars
$env.YOUR_ENV_VAR
Setting ephemeral env vars
$env.YOUR_ENV_VAR = "ENV_VAR_VALUE"
Setting permanent env vars
Open env.nu config file…
vim ~/.config/nushell/env.nu
Add the following line…
$env.PATH = ($env.path | | split row (char esep) | append "NEW_ENV_VAR")
Apply changes…
source ~/.config/nushell/env.nu
Reference env var
anvil --auto-impersonate --chain-id 1 --fork-url |
https://mainnet.infura.io/v3/($env.INFURA_KEY) --fork-block-number 21233424
Multi-line command
If it is all one command (use parentheses and just press enter):
( anvil --auto-impersonate --chain-id 1 --fork-url
https://mainnet.infura.io/v3/($env.INFURA_KEY) --fork-block-number 212334 )
If it is multiple commands, just go:
echo hi |
ls |
cd -
Write to a file
Read a file (like cat)
- Run
openinstead ofcat.