[Wylug-help] Shell scripting

John Hodrien johnh at comp.leeds.ac.uk
Mon May 10 13:38:14 BST 2004


On Mon, 10 May 2004, Alan J.Wylie wrote:

> On Sun, 09 May 2004 22:23:34 +0100, Nick Jeffery <stash at o2.ie> said:
>
> > Hullo, I've a variable (from cat'ing a file) in a bash shell script.
> > I'd like to get only the first 32 characters of the file/variable on
> > their own..
>
> > I've tried:
>
> > foo=`echo ${bar:32}` but that doesn't seem to want to play ball.
>
> foo=`echo ${bar:0:32}`

Why such a subshell fan?  Isn't foo=${bar:0:32} enough?

jh

--
"Come friendly bombs, and fall on Slough!
 It isn't fit for humans now,
 There isn't grass to graze a cow.
 Swarm over, Death."                                 -- Sir John Betjeman




More information about the Wylug-help mailing list