Skip to main content
added 17 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

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

while IFS= read -r 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 -rd '\n' -a list ./program.sh

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

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

while IFS= read -r 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 do
  case "$password" in
    'qwerty')
      echo 'Nice!'
      ;;
  esac
done

And then:

xargs -rd '\n' -a list ./program.sh
added 255 characters in body
Source Link
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

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

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
Source Link
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