note
sgt
<p>
not too sure about ash but you get less chars with: </p>
<code> print "${new% }" </code>
<p> another way showing off some aspects of modern shells
but still a bit longish...</p>
<code>
% stephan@labaule (/home/stephan) %
% cat rev.sh
#!/bin/ksh93
function rev
{
nameref s=$1; typeset a=( $s ); integer n=${#a[*]} i; s=; n=n-1
for i in {$n..0}; do s+="${a[i]} "; done; s=${s%?}
}
s=" one two three four "
rev s
print "[$s]"
% stephan@labaule (/home/stephan) %
% ksh93 rev.sh
[four three two one]
</code>
enjoy ;)
--steph
589260
589710