2012-11-23 110 views

回答

0

我會推薦下面的腳本。它要求你提供一個你想保留的應用程序的名字,想法是如果你剛剛開始使用heroku,你可以在練習時創建一堆應用程序,直到你找到一個正確的,然後想要刪除所有的應用程序休息。

myApp="$1" 
ignore=("===" "<your email address>" "Apps") 
allApps=($(heroku apps)) 

if [[ " ${allApps[@]} " =~ " $myApp " ]]; then 
    # if the given app name is a listed app name 
    for app in "${allApps[@]}"; do 
     if [[ ! "$app" = "$myApp" ]]; then 
      if [[ ! " ${ignore[@]} " =~ " $app " ]]; then 
       heroku apps:destroy --app $app --confirm $app 
      fi 
     fi 
    done 
else 
    echo "$1 is not a heroku app" 
fi 
相關問題