Home Index

1  Linux

2  xargs

Bash script executes on each line from text file as parameter passed into bash.
#-- text.txt --#
one
two
three

#-- receiver.sh --#
#!/bin/bash
echo "Line="$1

# -- execute ---#
cat text.txt | xargs -n1 ./receiver.sh

#-- output --#
Line=one
Line=two
Line=three

Copyright © 1997-2012 Kevin T. Duraj, All rights reserved
Agoura Hills, California -  Saturday, 19 May 2012