From 0ec2614799479a02942579a30fb935474ed647d2 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 25 Jul 2026 06:54:20 +0200 Subject: [PATCH] fix: dev container script container selection --- scripts/dev-containers | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/dev-containers b/scripts/dev-containers index 36d4436..50b6b19 100755 --- a/scripts/dev-containers +++ b/scripts/dev-containers @@ -27,7 +27,7 @@ fi echo " janishutz dev containers -" + " if [[ $(systemctl is-active docker) != "active" ]]; then echo " -> Docker daemon not running, starting with systemctl <- @@ -38,7 +38,7 @@ fi if [[ $1 == "rm" ]]; then echo " -> Removing containers with $name in their name <- -" + " if [[ $(read -p "Do you really want to delete ALL containers for this directory? (y/N) " response && echo $response) == 'y' ]]; then for container in $(docker container ls -aq -f name=$name); do docker stop $container @@ -63,27 +63,27 @@ elif [[ $1 == "shell" ]]; then elif [[ $count == 1 ]]; then echo " -> Connecting to running container ${containers[0]} -" + " docker exec -it ${containers[0]} '/bin/bash' else echo " -> Multiple possible containers found to attach to. Pick one (enter number) " docker ps -f name=$name - read -p "Enter number (1-$(${#containers[@]})) " sel - docker exec -it containers[$sel] '/bin/bash' + read -p "Enter number (1-$count) " sel + docker exec -it ${containers[$(($sel-1))]} '/bin/bash' fi else name=$name-$1 if [[ $(docker container ls -aq -f name=$name) != "" ]]; then echo " -> Starting existing container $name <- -" + " docker start -i $name else echo " -> Creating container $name <- -" + " eval "${base_path}$1-container $name $mount_path" fi fi