[Wylug-help] Shell scripting

Alan J.Wylie jlyht at wylie.me.uk
Mon May 10 07:23:55 BST 2004


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}`

--
Alan J. Wylie                                          http://www.wylie.me.uk/
"Perfection [in design] is achieved not when there is nothing left to add,
but rather when there is nothing left to take away."
  -- Antoine de Saint-Exupery




More information about the Wylug-help mailing list