Pacific-Design.com

    
Home Index

1. Bash

2. xargs

Bash / xargs /

xargs - execute a command once per line of piped input.

#-- 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