Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: Getting at the first char of a string in Bourne shell Message-ID: <1990Oct02.033407.5415@chinet.chi.il.us> Date: 2 Oct 90 03:34:07 GMT References: <9737@jpl-devvax.JPL.NASA.GOV> <1990Sep29.193617.25752@iwarp.intel.com> <1990Sep29.215559.25098@cti-software.nl> Organization: Chinet - Chicago Public Access UNIX Lines: 24 In article <1990Sep29.215559.25098@cti-software.nl> pim@cti-software.nl (Pim Zandbergen) writes: >How about >string=`echo $string | cut -c1` >I don't think the Bourne shell can do this without executing >an external command. There's always something like: string=foo for i in a b c d e f g (you know the rest...) do case "$string" in $i*) first=$i break ;; esac done echo $first Les Mikesell les@chinet.chi.il.us