0

I'm trying to create a function, but I want to trigger by either aliases : debugApp, debugApi

Rather than creating 2 functions to do the same thing

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
}

Is there a better way?

3
  • I know that I can just do this alias debugApp=debugApi, but I'm wondering if there is another way. – cyb3rZ Jun 3 '20 at 22:32
  • 1
    What about debugApi() { debugApp; }? – Cyrus Jun 4 '20 at 22:20
  • 1
    @Cyrus that looks more like an answer than a comment! :) – user68186 Jun 4 '20 at 22:43
0

I did this to get it to work

alias debugApp=debugApi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.