[comp.unix.shell] Parameter expansion on program output in KSH

jbn35564@uxa.cso.uiuc.edu (J.B. Nicholson) (04/16/91)

Is it possible to use parameter expansion on program output w/o assigning
a variable first?  For example, is it possible to say something to the
effect of:

print ${$(hostname)%%.*}

instead of:

HOSTNAME=$(hostname)
print ${HOSTNAME%%.*}

Thanks.

Jeff
--
+----------------------------------------------------------------------------+
| "If you hear an onion ring - answer it."                    J.B. Nicholson |
+----------------------------------------------------------------------------+
| jeffo@uiuc.edu (Internet)              These opinions are mine, that's all.|
+----------------------------------------------------------------------------+

marcus@illusion.uucp (Marcus Hall) (04/17/91)

In article <1991Apr16.023454.2369@ux1.cso.uiuc.edu> jeffo@uiuc.edu writes:
>Is it possible to use parameter expansion on program output w/o assigning
>a variable first?  For example, is it possible to say something to the
>effect of:
>
>print ${$(hostname)%%.*}
>
>instead of:
>
>HOSTNAME=$(hostname)
>print ${HOSTNAME%%.*}

Try:
	eval print \${$hostname%%.*}

marcus hall