From 752275bc50b8a7c415dc5f30b05adddfbee92efe Mon Sep 17 00:00:00 2001 From: fanta Date: Wed, 5 Oct 2022 08:57:29 +0200 Subject: [PATCH] permite elegir que distro descargar en vez de todas --- q | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/q b/q index 820c71a..80c59eb 100755 --- a/q +++ b/q @@ -3,6 +3,7 @@ vmsDir="$HOME/vms" function main(){ downloadSysList + filterList downloadSysIsos showVms } @@ -12,6 +13,19 @@ function downloadSysList(){ wget --no-check-certificate -q "http://fanta.56k.es/q/systems.lst" -O $vmsDir/.systems.lst } +function filterList(){ + cat -n $vmsDir/.systems.lst | cut -d ";" -f 1,2 | tr ";" " " + echo " " + read -p "Number: " option + if [[ $option == ?(-)+([0-9]) ]] ; then + cat $vmsDir/.systems.lst | head -$option | tail -1 > $vmsDir/.systems2.lst + mv $vmsDir/.systems2.lst $vmsDir/.systems.lst + else + echo -e "\nError: Try again and enter a integer number my friend" + exit + fi +} + function downloadSysIsos(){ while read system; do data=("$(echo "$system" | cut -d ";" -f 1)" "$(echo "$system" | cut -d ";" -f 2)" "$(echo "$system" | cut -d ";" -f 3)" "$(echo "$system" | cut -d ";" -f 4)" "$(echo "$system" | cut -d ";" -f 5)" "$(echo "$system" | cut -d ";" -f 6)" "$(echo "$system" | cut -d ";" -f 7)" "$(echo "$system" | cut -d ";" -f 8)")