Richard Neill wrote: > $ echo ${stringZ:2: -1} #Wish: start at 2, read till > ERROR #1 before the end. i.e. > # cde > > $ echo ${stringZ: -3: -1} #Wish: start 3 back, read till > ERROR #1 before the end. i.e.
Use (-1), i.e. $ echo ${stringZ:2:(-1)} See also http://bash-hackers.org/wiki/doku.php/syntax/pe#substring_expansion (at bottom of the section). J.