Getting at the first char of a string in Bourne shell
Pim Zandbergen
pim at cti-software.nl
Sun Sep 30 07:55:59 AEST 1990
How about
string=`echo $string | cut -c1`
I don't think the Bourne shell can do this without executing
an external command.
In Korn shell you can use a hack like
string=${string%${string#?}}
--
Pim Zandbergen domain : pim at cti-software.nl
CTI Software BV uucp : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70 phone : +31 70 3542302
2585 GD The Hague, The Netherlands fax : +31 70 3512837
More information about the Comp.unix.shell
mailing list