Skip to content

Commit

Permalink
set 'balloonName' to a default value in the delete, restart, and stop…
Browse files Browse the repository at this point in the history
… scripts if the argument is empty.
  • Loading branch information
hiroTochigi committed Feb 8, 2024
1 parent 8cecc01 commit c504d0f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/aws/delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASE=/home/pi

function delete(){

balloonName=$1
balloonName=$(setBalloonName "$1")

if ! isBalloonNameValid "$balloonName"; then
echo "Please provide a valid balloon name"
Expand Down
7 changes: 7 additions & 0 deletions src/aws/dependencies/utilitiyFunction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ function waitForOutput(){
echo $result
}

setBalloonName() {
if [ -z "$1" ]; then
echo "luftballon"
else
echo "$1"
fi
}
2 changes: 1 addition & 1 deletion src/aws/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BASE=/home/pi

function restart(){
balloonName=$1
balloonName=$(setBalloonName "$1")

if ! isBalloonNameValid "$balloonName"; then
echo "Please provide a valid balloon name"
Expand Down
2 changes: 1 addition & 1 deletion src/aws/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BASE=/home/pi

function stop(){
balloonName=$1
balloonName=$(setBalloonName "$1")
if ! isBalloonNameValid "$balloonName"; then
echo "Please provide a valid balloon name"
exit 1
Expand Down

0 comments on commit c504d0f

Please sign in to comment.