From 975715da5b2c1d31be466b17bc7a25c1999ed28d Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 8 Jan 2025 13:55:47 +0100 Subject: Use params instead of `read` function --- scripts/01-create-bucket.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'scripts/01-create-bucket.sh') diff --git a/scripts/01-create-bucket.sh b/scripts/01-create-bucket.sh index 364e098..30bedc0 100755 --- a/scripts/01-create-bucket.sh +++ b/scripts/01-create-bucket.sh @@ -1,17 +1,18 @@ #!/bin/sh -path=$(find . -name 'order_products.csv' -print -quit) +path="$1" -if [ -z "$path" ]; then - read -p "Enter 'order_products.csv' path: " path - if [ -z "$path" ] || [ ! -e "$path" ]; then +if [ -z "$path" ] || [ ! -e "$path" ]; then + path=$(find . -name 'order_products.csv' -print -quit) + + if [ -z "$path" ]; then echo ">>>> Path not found..." exit 1 fi fi -gcloud storage buckets create gs://$BUCKET_NAME --location=eu +gcloud storage buckets create gs://${BUCKET_NAME} --location=eu gcloud storage buckets add-iam-policy-binding gs://${BUCKET_NAME} \ --member="serviceAccount:${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com" \ --role="roles/storage.objectCreator" -gcloud storage cp $path gs://$BUCKET_NAME/input/ +gcloud storage cp $path gs://${BUCKET_NAME}/input/ -- cgit v1.2.3-18-g5258