Skip to main content
Fixed formatting
Source Link
terdon
  • 252.3k
  • 69
  • 480
  • 718

There is a program like this:

while true
do
            echo 'Your pass: '
            read password
        if [ $password == 'qwerty' ]; then 
            echo 'Nice!'
            break
        fi
done

I can use xargs only if the program has arguments. But in this case ./program.sh password doesn't work. I have a list of password and I need to send them in loop to this program.

xargs -a list ./program.sh doesn't work.

There is a program like this:

while true
do
            echo 'Your pass: '
            read password
        if [ $password == 'qwerty' ]; then 
            echo 'Nice!'
            break
        fi
done

I can use xargs only if the program has arguments. But in this case ./program.sh password doesn't work. I have a list of password and I need to send them in loop to this program.

xargs -a list ./program.sh doesn't work.

There is a program like this:

while true
do
    echo 'Your pass: '
    read password
    if [ $password == 'qwerty' ]; then 
        echo 'Nice!'
        break
    fi
done

I can use xargs only if the program has arguments. But in this case ./program.sh password doesn't work. I have a list of password and I need to send them in loop to this program.

xargs -a list ./program.sh doesn't work.

Source Link
TrueBad0ur
  • 313
  • 1
  • 2
  • 7

Use xargs if IF statements is inside the program code

There is a program like this:

while true
do
            echo 'Your pass: '
            read password
        if [ $password == 'qwerty' ]; then 
            echo 'Nice!'
            break
        fi
done

I can use xargs only if the program has arguments. But in this case ./program.sh password doesn't work. I have a list of password and I need to send them in loop to this program.

xargs -a list ./program.sh doesn't work.