Optimize test script to avoid redundant busybox --list calls

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-29 19:36:36 +00:00
parent c181bd4530
commit 1c1505c805

View File

@@ -23,12 +23,14 @@ if command -v busybox >/dev/null 2>&1; then
fi fi
echo "" echo ""
echo "Available BusyBox applets (sample):" echo "Available BusyBox applets (sample):"
busybox --list | head -n 20 # Store applet list once to avoid redundant executions
echo " ... and $(busybox --list | wc -l) total applets" APPLET_LIST=$(busybox --list)
echo "$APPLET_LIST" | head -n 20
echo " ... and $(echo "$APPLET_LIST" | wc -l) total applets"
echo "" echo ""
echo "Networking applets (required for SparkOS):" echo "Networking applets (required for SparkOS):"
for cmd in udhcpc ip ifconfig ping wget; do for cmd in udhcpc ip ifconfig ping wget; do
if busybox --list | grep -q "^${cmd}$"; then if echo "$APPLET_LIST" | grep -q "^${cmd}$"; then
echo "$cmd" echo "$cmd"
else else
echo "$cmd (NOT FOUND)" echo "$cmd (NOT FOUND)"