bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-bash] Re: offset bug?


From: Chet Ramey
Subject: [Bug-bash] Re: offset bug?
Date: Fri, 15 Sep 2000 11:43:00 -0400

> 
> Hello,
> 
> It is written in the 'man bash':
> 
> ${parameter:offset:length}
> If offset evaluates to a number less than zero, the value is used as an
> offset  from  the  end  of  the value  of  parameter.
> 
> But:
> 
> address@hidden 17:25:14 148 ~ >echo $HOME
> /dioscuri_1/alex
> address@hidden 17:32:53 161 ~ >echo ${HOME:-3:0}
> /dioscuri_1/alex
> address@hidden 17:29:54 155 ~ >echo ${HOME:-3:3}
> /dioscuri_1/alex
> address@hidden 17:30:01 157 ~ >echo ${HOME:-3:-3}
> /dioscuri_1/alex

These last three are not doing what you expect because of the `:-'.
That is a different expansion.  If you want to use negative offsets,
make sure they are separated from the `:' by a space.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]