home ~ projects ~ socials

Use 'type' To Figure Out Which File A bash Function Is In

I write a bunch of little functions for frequently used command line commands. For example, I have this for browser-sync in my dotfiles:

function bs () {

browser-sync . --port 3939 \
--watch --directory \
--no-notify --no-inject-changes

}

The problem is I can never remember I put those file.

Using which or whence doesn't show the file location. Just the function or its name.

type gets you to the file path though:

type bs
Output:
bs is a shell function from 
/Users/alan/.zsh_tools/bs.zsh

Figuring that out will be less of a problem one I have everythig moved into my grimoire and can search for them there. Until then, this has me covered.

-- end of line --

References