Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <01BEBCCD.B8147AA0.saieww@softwareag.com> From: william walsh To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: B20 - Getting substring functionality to work Date: Tue, 22 Jun 1999 16:38:52 +0100 Organization: software-ag X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello all, I am trying to get substring functionality to work for use within GNUMake under WindowsNT. cygwin is B20 with the 16Jan99 updated dll. The bash reference says: ${parameter:offset} ${parameter:offset:length} Expands to up to length characters of parameter, starting at offset. If length is omitted, expands to the substring of parameter, starting at the character specified by offset. length and offset are arithmetic expressions (see section Arithmetic Evaluation). This is referred to as Substring Expansion. length must evaluate to a number greater than or equal to zero. If offset evaluates to a number less than zero, the value is used as an offset from the end of the value of parameter. If parameter is `@', the result is length positional parameters beginning at offset. If parameter is an array name indexed by `@' or `*', the result is the length members of the array beginning with ${parameter[offset]}. Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1. At the bash shell prompt this works: $ JUNK=BLAHBLAHWOOFWOOF $ BLAH=${JUNK} $ echo $BLAH BLAHBLAHWOOFWOOF But, any other permutation that adds a colon to the invocation as in: $ BLAH=${JUNK:2:2} results in: Syntax error: Bad substitution What am I doing wrong? If I get this to work what happens if I use a negative offset that has an absolute value greater than the length of the string and/or of the length value? Regards, William -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com