EXPORT AWS_profile=albt_alb_dev;
aws s3 rm s3://albt-alb-prd-us-east-1-raw/albdev/Test/Folder1/ --recursive --exclude "" --profile $AWS_profile;
我為存盤桶名稱和檔案夾名稱提供了硬編碼值。我需要引數化上述腳本中使用的存盤桶名稱和檔案夾名稱。
如果 Bucket name 和 Folder name 不同,我需要相應地在腳本中進行更改。
誰能指導如何實作這一目標?
謝謝!
uj5u.com熱心網友回復:
您可以簡單地使用如下引數:
EXPORT AWS_profile=albt_alb_dev;
bucketName="albt-alb-prd-us-east-1-raw"
folderName="Folder1"
aws s3 rm s3://$bucketName/albdev/Test/$folderName/ --recursive --exclude "" --profile $AWS_profile;
或者您可以將引數傳遞給腳本:
EXPORT AWS_profile=albt_alb_dev;
bucketName=$1 #first argument to the script
folderName=$2 #second argument to the script
aws s3 rm s3://$bucketName/albdev/Test/$folderName/ --recursive --exclude "" --profile $AWS_profile;
并這樣稱呼它:
./script.sh albt-alb-prd-us-east-1-raw Folder1
您當然可以引數化整個路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/515193.html
