George Naranjo


how to write function in fish

how to write function in fish

George Naranjo's photo
George Naranjo
·Jul 7, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

how to write basic functions in fish shell


First off to create a function while in the fish shell we will type "func" and then pass an arguemnt and that will be the function name you desire.

funced test

You can pass these flags for

  • i | interactive mode
  • e | open in external editor
  • s | autosave after succesful edit

    funced -i test


    Save your function, test your function first to make sure it works.

    funsave test

    example functions

    example functions


    make dir and cd into it and also pwd

       mkdir $argv && cd $argv && pwd


    cd into my project folder then git clone a project

      cd projects && git clone $argv


search the aur with yay -s

yay -s $argv

You can now create basic funtions in fish!

here are my git files, check them out! fish-functions on Github

Share this