更新软件结构

This commit is contained in:
lsy 2024-09-26 16:03:53 +08:00
parent b460838426
commit 5db4586f2b

View File

@ -11,17 +11,17 @@ case $pick in
docker ps --format "{{.Names}}" docker ps --format "{{.Names}}"
;; ;;
'2') '2')
declare -a deocker_arr=($(docker ps --format "{{.Names}}")) declare -a docker_arr=($(docker ps --format "{{.Names}}"))
declare deocker_number=0 declare docker_number=0
for i in "${!docker_arr[@]}" ; do for i in "${docker_arr[@]}" ; do
deocker_number=$(( deocker_number+1 )) docker_number=$(( docker_number+1 ))
echo "${deocker_number}.${i}" echo "${docker_number}.${i}"
done done
echo "要删除的镜像序号,多个镜像用 空格 隔开" echo "要删除的镜像序号,多个镜像用 空格 隔开"
read -p "请输入:" pick read -p "请输入:" pick
for i in $pick ; do for i in $pick ; do
if [[ $i =~ [1-$deocker_number] ]]; then if [[ $i =~ [1-$docker_number] ]]; then
docker rmi "${deocker_arr[$i]}" docker rmi "${docker_arr[$i]}"
fi fi
done done
;; ;;