Hi Roy, Roy Marples schrieb: > You can use arrays with any shell with a little thought > > #!/bin/ash > url='http://....' > set -- `wget -q -O - $url` > i = 0 > for file; do > echo "$i - $file" > i=$(($i + 1)) > done > > DISCLAIMER: The above was typed directly into an email and not actually > tested. thank you very much! And sorry that I'm not yet more familar with shell scripting, but still learning ....
Here's what I have now, and this works basically, though still need to understand the set construct: #!/bin/ash url='http://www.busybox.net/downloads/snapshots/?F=0' dst='/tmp' echo -e "*** File list from ${url%/*} ***\n" set -- `wget -q -O - $url | grep '^<li>' | cut -d\" -f2` i=0 for file; do i=$(($i + 1)) printf "%3d - %s\n" $i $file done echo "" read -p "Select file # for download: " n until test 0 -lt "$n" -a "$n" -le "$i" ; do echo "Value is not in range (1 - $i) - try again!" read -p "Select file # for download: " n done i=0 for file; do i=$(($i + 1)) test "$n" -eq "$i" && break done echo "" echo "File: $file" url="${url%/*}/$file" echo wget -nv -P $dst -O $file $url one thing I didnt find yet in any docu: how can I catch if a string is entered instead of a number with read? Also if there's still a better / shorter way to do the same I would love to hear about! thanks again for your help! Guen. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
