Search code examples
fish

Fish dynamically define a function


function fish_title; echo bar; end

I'd like to create a set_title function that will give the equivalent result of the above i.e. by running set_title bar. Any ideas?


Solution

  • I get it now. You need this:

    function set_title -a new_title
        eval "function fish_title; echo $new_title; end"
    end