1 year ago

#380554

test-img

Liso

Weird behavior with busybox grep and wget in alpine linux

I'm trying to grep a string from wget --help, I want to check if implementation of wget support my desired option.

wget --help | grep -q '\--show-progress'

I expect if the command failed, it will return non-zero exit code-- this is my intention. But executing this on Alpine Linux 3.13 give following result.

~ # wget --help | grep -q '\--show-progress'
BusyBox v1.32.1 () multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
        [-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off]
        [-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o FILE         Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
~ #

No matter what I do, it still print the whole --help section. Is there any workaround ? Im using Alpine Linux 3.13

shell

grep

alpine-linux

busybox

ash

0 Answers

Your Answer

Accepted video resources