#!/bin/sh
# xargs1
# Almost like xargs but,
# It fix n=1 (one parameter at a time), and it can use more than one
# instance of {} to represent the
#set -xv
if [ "$1" = "-v" ] ; then
sonly=1 # show cmd to be executed only
shift
else
sonly=0
fi
# if no {} supplied on command line,
# add at the end
echo $* | grep '\{\}' >/dev/null
if [ $? -eq 1 ] ; then set -- $* "{}" ; fi
while read ii ; do
cmd=`echo $* | sed -e "s|{}|$ii|g"`
echo
echo ">$cmd"
#X exec $cmd # only once!?
if [ !$sonly ] ; then eval $cmd ; fi
# *N*: "! $sonly" will not work!
# no space allowed after "!"
# also can issure $cmd directly without eval, if no redirect envolved
done