多个别名触发相同功能

多个别名触发相同功能

我正在尝试创建一个函数,但我想通过别名触发:debugAppdebugApi

而不是创建两个函数来做同样的事情

debugApp() {

    #update .env to generate log
    sed -i -e 's/.*API_DEBUG=.*/API_DEBUG=true/g' /Users/jdoe/laravel/.env
    echo "-----------------------"
    cat /Users/jdoe/laravel/.env | grep API_DEBUG


    #remove old logs
    # rm -rf /Users/jdoe/laravel/storage/logs/*
    ls /Users/jdoe/laravel/storage/logs/

    #display correct logs
    tail -f /Users/jdoe/laravel/storage/logs/laravel-$(date "+%Y-%m-*").log
}


debugApi() {

    #update .env to generate log
    sed -i -e 's/.*API_DEBUG=.*/API_DEBUG=true/g' /Users/jdoe/laravel/.env
    echo "-----------------------"
    cat /Users/jdoe/laravel/.env | grep API_DEBUG


    #remove old logs
    # rm -rf /Users/jdoe/laravel/storage/logs/*
    ls /Users/jdoe/laravel/storage/logs/

    #display correct logs
    tail -f /Users/jdoe/laravel/storage/logs/laravel-$(date "+%Y-%m-*").log
}

有没有更好的办法?

答案1

我这样做是为了让它工作

别名 debugApp=debugApi

相关内容