How do I unset a variable in the fish shell?

后端 未结 1 854
粉色の甜心
粉色の甜心 2021-01-31 13:30

In bash I can unset a variable with

unset myvar

In fish I get

fish: Unknown command \'unset\'

What\'s the e

相关标签:
1条回答
  • 2021-01-31 13:57

    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'
    
    0 讨论(0)
提交回复
热议问题