Article View: comp.unix.shell
Article #1298Re: Getting at the first char of a string in Bourne shell
From: C C Evert
Date: Mon, 01 Oct 1990 20:39
Date: Mon, 01 Oct 1990 20:39
16 lines
1073 bytes
1073 bytes
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
Technical Details
Message-ID:
<884@airgun.wg.waii.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!airgun!cevertReferences:
<1308@ncrwat.Waterloo.NCR.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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