[Wylug-help] Shell scripting

Jason Lander jason at env.leeds.ac.uk
Sun May 9 22:43:37 BST 2004


> 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..

> foo=`echo ${bar:32}`  but that doesn't seem to want to play ball.

How about reading the first 32 characters directly via

  foo=`dd if=your-file bs=32 count=1`

- Jason





More information about the Wylug-help mailing list