In bash I can unset a variable with
unset myvar In fish I get
fish: Unknown command 'unset' What's the equivalent for unset in fish.
To give a variable to an external command, it needs to be “exported”. Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to set , either --export or just -x .
Using the set -n command Alternatively, you can unset environment variables by using the set command with the “-n” flag.
To clear all variables from the current workspace, use clear or clearvars .
Fish uses options on the set command to manipulate shell variables.
Unset a variable with the -e or --erase option.
set -e myvar Additionally you can define a function
function unset set --erase $argv end funcsave unset or an abbreviation
abbr --add unset 'set --erase' or an alias in ~/.config/fish/config.fish
alias unset 'set --erase'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With