[comp.unix.questions] Sending quotes to rsh

mills@ccu.umanitoba.ca (Gary Mills) (07/27/90)

Is this the best way to quote the remote arguements to rsh?  It works,
but seems a bit complicated.  This is SunOs 4.0.3.

---------------8<---------------------8<----------------------
#!/bin/sh
# usage: mailer [-f from] address address ...
#
O="-f MAILER-DAEMON"
S=other_host

case $1 in
	-f) O="-f '$2'";shift 2;;
esac
R="$O"
for A in "$@"
do
	R="$R '$A'"
done

rsh $S echo "$R"

##
-- 
-Gary Mills-             -University of Manitoba-             -Winnipeg-