On Fri, Feb 08, 2008 at 05:03:40PM +0100, Michael wrote:
| Hi,
| 
| Han Boetes schrieb:
| > Michael wrote:
| >> I am looking for sh/ksh replacement for the following bash command:
| >>
| >> $ X="abcdefghi"
| >> $ echo ${X:0:2}
| >> ab
| > 
| > cut(1)
| 
| Thanks a lot, sometimes the obvious solutions are the hardest to find...
| 
| $ X="abcdefghi"
| $ echo $X | cut -c 1-2
| ab

Note that it's not a complete replacement for bash's
${parameter:offset:length} parameter expansion implementation. If you
give it @ or an array as a parameter, behaviour is completely
different.

Cheers,

Paul 'WEiRD' de Weerd 

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 

Reply via email to