Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!airgun!cevert From: cevert@airgun.wg.waii.com (C C Evert) Newsgroups: comp.unix.shell Subject: Re: Getting at the first char of a string in Bourne shell Summary: Single strippers Message-ID: <884@airgun.wg.waii.com> Date: 1 Oct 90 20:39:55 GMT References: <1308@ncrwat.Waterloo.NCR.COM> Organization: Western Geophysical, Houston Lines: 16 In article <1308@ncrwat.Waterloo.NCR.COM>, ken@images1.Waterloo.NCR.COM (Ken Braithwaite) writes: > I am trying to peel off one at a time the letters from a variable > in the Bourne shell, ie from Bourne get B and ourne. > How can I do this? > Thanks in advance. > expr "$SHELL" : '\(.\).*' prints the first letter of SHELL expr "$SHELL" : '.\(.*\)' prints all but the first letter of SHELL You still need to check for SHELL being empty. -- C C Evert Western Geophysical - A division of Western Atlas International, A Litton/Dresser Company DOMAIN addr: cevert@airgun.wg.waii.com UUNET address: uunet!airgun!cevert