我正在尝试创建一个函数,但我想通过任一别名触发:debugApp
,debugApi
而不是创建 2 个函数来做同样的事情
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
}
有没有更好的办法?
我这样做是为了让它工作