public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: B20 - Getting substring functionality to work
@ 1999-06-23  1:38 william walsh
  1999-06-30 22:10 ` william walsh
  0 siblings, 1 reply; 6+ messages in thread
From: william walsh @ 1999-06-23  1:38 UTC (permalink / raw)
  To: 'Heinz-Jurgen Oertel'; +Cc: 'cygwin@sourceware.cygnus.com'

On Wednesday, June 23, 1999 9:30 AM, Heinz-Jurgen Oertel [SMTP:oe@port.de] 
wrote:
> william walsh wrote:
> >
> > 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:
> >
> [snip]
> > 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
> >
>
> are you shure using 'bash' ?
> at me it works.
You are correct I was using sh instead of bash and the basic functionality 
works fine.  I still cannot get the negative offset to work.  My 
understanding is a negative offset should count from the end of the string; 
it seems to act like a zero offset.

Thanks.
>
>
>
>   Heinz
>
>
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: B20 - Getting substring functionality to work
  1999-06-23  1:38 B20 - Getting substring functionality to work william walsh
@ 1999-06-30 22:10 ` william walsh
  0 siblings, 0 replies; 6+ messages in thread
From: william walsh @ 1999-06-30 22:10 UTC (permalink / raw)
  To: 'Heinz-Jurgen Oertel'; +Cc: 'cygwin@sourceware.cygnus.com'

On Wednesday, June 23, 1999 9:30 AM, Heinz-Jurgen Oertel [SMTP:oe@port.de] 
wrote:
> william walsh wrote:
> >
> > 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:
> >
> [snip]
> > 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
> >
>
> are you shure using 'bash' ?
> at me it works.
You are correct I was using sh instead of bash and the basic functionality 
works fine.  I still cannot get the negative offset to work.  My 
understanding is a negative offset should count from the end of the string; 
it seems to act like a zero offset.

Thanks.
>
>
>
>   Heinz
>
>
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: B20 - Getting substring functionality to work
  1999-06-23  1:32 ` Heinz-Jürgen Oertel
@ 1999-06-30 22:10   ` Heinz-Jürgen Oertel
  0 siblings, 0 replies; 6+ messages in thread
From: Heinz-Jürgen Oertel @ 1999-06-30 22:10 UTC (permalink / raw)
  To: william walsh; +Cc: 'cygwin@sourceware.cygnus.com'

william walsh wrote:
> 
> 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:
> 
[snip]
> 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
> 

are you shure using 'bash' ?
at me it works.



  Heinz



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* B20 - Getting substring functionality to work
  1999-06-22  8:47 william walsh
  1999-06-23  1:32 ` Heinz-Jürgen Oertel
@ 1999-06-30 22:10 ` william walsh
  1 sibling, 0 replies; 6+ messages in thread
From: william walsh @ 1999-06-30 22:10 UTC (permalink / raw)
  To: 'cygwin@sourceware.cygnus.com'

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@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: B20 - Getting substring functionality to work
  1999-06-22  8:47 william walsh
@ 1999-06-23  1:32 ` Heinz-Jürgen Oertel
  1999-06-30 22:10   ` Heinz-Jürgen Oertel
  1999-06-30 22:10 ` william walsh
  1 sibling, 1 reply; 6+ messages in thread
From: Heinz-Jürgen Oertel @ 1999-06-23  1:32 UTC (permalink / raw)
  To: william walsh; +Cc: 'cygwin@sourceware.cygnus.com'

william walsh wrote:
> 
> 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:
> 
[snip]
> 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
> 

are you shure using 'bash' ?
at me it works.



  Heinz



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* B20 - Getting substring functionality to work
@ 1999-06-22  8:47 william walsh
  1999-06-23  1:32 ` Heinz-Jürgen Oertel
  1999-06-30 22:10 ` william walsh
  0 siblings, 2 replies; 6+ messages in thread
From: william walsh @ 1999-06-22  8:47 UTC (permalink / raw)
  To: 'cygwin@sourceware.cygnus.com'

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@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-06-30 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-23  1:38 B20 - Getting substring functionality to work william walsh
1999-06-30 22:10 ` william walsh
  -- strict thread matches above, loose matches on Subject: below --
1999-06-22  8:47 william walsh
1999-06-23  1:32 ` Heinz-Jürgen Oertel
1999-06-30 22:10   ` Heinz-Jürgen Oertel
1999-06-30 22:10 ` william walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).