1 year ago

#371399

test-img

Bleakley

zsh $fpath file with multiple functions

In order to load functions in zsh, everything I read says that each function needs to be in separate file and that file needs to be the same name last the function. the path to that function then also needs to be in your $fpath.

Is it possible to have multiple functions in one file in $fpath?

For instance:

    # rsync transfer for DAMS uploads
function rsyncDAMS () {
    rsync -avvPhi --no-p --stats "${@}"
}
export -f rsyncDAMS

    # general rsync transfer
function rsyncT () {
    rsync -avvPhi --stats "${@}"
}
export -f rsyncT

    # general rsync transfer with deletion of source files
function rsyncD () {
    rsync -avvPhi --remove-source-files --stats "${@}"
}
export -f rsyncD

instead of three separate files called rsyncDAMS, rsyncT and rsyncD

could I have one file called rsync_functions with all three of those functions in it and be able to call each function separately by its name? I'd put the ```rsync`` files in my $fpath but I've read nothing that says this will work.

Will it?

function

zsh

zshrc

0 Answers

Your Answer

Accepted video resources