Skip to main content
2 of 3
added 255 characters in body
terdon
  • 252.3k
  • 69
  • 480
  • 718

There's no reason to use xargs here, you can simply do:

while read password
do
    if [ "$password" = 'qwerty' ]; then 
        echo 'Nice!'
        break
    fi
done

And then run it as:

./program.sh < list

If you really want xargs, you can do something like:

for password in "$@"
do
  case "$password" in
    'qwerty')
      echo 'Nice!'
      ;;
  esac
done

And then:

xargs -a list ./program.sh
terdon
  • 252.3k
  • 69
  • 480
  • 718