开发者

Including/Importing aliases and functions for both bash and zsh

开发者 https://www.devze.com 2022-12-30 17:01 出处:网络
I have a directory of functions and aliases I\'d like to include for both bash and zsh terminal invocations (So I don\'t need to put every function and开发者_高级运维 alias into every separate script

I have a directory of functions and aliases I'd like to include for both bash and zsh terminal invocations (So I don't need to put every function and开发者_高级运维 alias into every separate script and to facilitate organization/tidying of .rc files)

What I've tried so far hasn't worked. Just setting this out for further suggestions.


For zsh I'm using

if [ -d ~/.zsh.d ]; then
    for i in ~/.zsh.d/*.sh; do
        if [ -r $i ]; then
            . $i
        fi
    done
    unset i
fi

Should work for bash, too.

0

精彩评论

暂无评论...
验证码 换一张
取 消