Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!abcfd20.larc.nasa.gov!tab00.larc.nasa.gov!scott From: scott@tab00.larc.nasa.gov (Scott Yelich) Newsgroups: comp.unix.shell Subject: Re: Getting at the first char of a string in Bourne shell Message-ID: Date: 1 Oct 90 03:21:41 GMT References: <1308@ncrwat.Waterloo.NCR.COM> <9737@jpl-devvax.JPL.NASA.GOV> <1990Sep29.193617.25752@iwarp.intel.com> <1990Sep29.215559.25098@cti-software.nl> Sender: news@abcfd20.larc.nasa.gov (USENET File Owner) Organization: NASA Langley Research Center, Hampton, Va. 23665 Lines: 27 In-Reply-To: pim@cti-software.nl's message of 29 Sep 90 21:55:59 GMT >I don't think the Bourne shell can do this without executing >an external command. Uh, it CAN be done... the question is whether you want to fork another process or have a massive hack to accomplish something which is actually a minimal function (Lets pass a lisp function to get the first letter to emacs... etc). As an EXAMPLE only, and an example which YOU can expand... STRING="STRING" set +F case "$STRING" in S* ) FIRST=S;; esac echo "The first letter of \`\`$STRING'' is \`\`$FIRST\'\' Now, do you REALLY want to do this? -- Signature follows. [Skip now] ----------------------------------------------------------------------------- Scott D. Yelich scott@[xanth.]cs.odu.edu [128.82.8.1] After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?'' Administrator of: Game-Design requests to ODU/UNIX/BSD/X/C/ROOT/XANTH/CS/VSVN/ -----------------------------------------------------------------------------